<template>
	<view>
		<view class="rePair_detail">
			<view class="nav" :style="{ background: showBg ? '#333' : '' }">
				<global-nav-bar type="black" left-icon="back" :color="showBg ? '#fff' : '#333'" :title="navBarTitle"
					:fixed="false" :isLeftBackShow="isLeftBackShow" backgroundColor="rgba(0, 0, 0, 0)"></global-nav-bar>
			</view>
			<view>
				<image class="bg"
					src="https://592800-erised-fresh.oss-cn-shenzhen.aliyuncs.com/upload/20221012/cdbdb2f4d67c21d9e1e8089234d17085.png"
					mode="" v-if="!showBg"></image>
			</view>
			<!-- 头部进度条 -->
			<view class="header">
				<elevtor-card :msg="{
					...elevatorDetail,
					elevatorId: this.elevatorId,
					isFull: this.isFull,
					isHistory: isFromHistory,
				}">
				</elevtor-card>
				<!-- 切换状态 -->
				<view v-if="status == 3 && !isCreateFrom" @click.prevent="changeState" class="statusArea" :style="{
					color: elevatorDetail.isStop == 1 ? '#0091ff' : '#E02020',
					zIndex: showBg ? 110 : 120,
				}">{{ elevatorDetail.isStop == 1 ? "正常运行" : "停梯" }}
					<image v-if="elevatorDetail.isStop == 1" class="statusSwich" src="@/static/images/blue.png" mode="">
					</image>
					<image v-if="elevatorDetail.isStop == 2" class="statusSwich" src="@/static/images/red.png" mode="">
					</image>
				</view>
			</view>
			<view class="addressBox">
				<view class="addressBox_left">
					<view class="top">
						<view class="name">
							<image src="@/static/images/index/buildIcon.svg" mode=""></image>
							<view>{{ elevatorDetail.buildingName }}</view>
						</view>
					</view>
					<view class="buildAddress" @click.stop="petName(elevatorDetail)" v-if="
						elevatorDetail.relationAlias &&
						elevatorDetail.relationAlias.length
					">
						<view class="buildings">项目别名:{{
							elevatorDetail.relationAlias.map((item) => item.alias).join(",")
						}}</view>
						<view>
							<uni-icons :type="popupShow ? 'arrowup' : 'arrowdown'" size="14" color="#999;"></uni-icons>
						</view>
					</view>
					<view class="buildAddress" @click.stop="toProjectDetail">{{
						elevatorDetail.buildingAddress
					}}</view>
				</view>
				<view class="addressBox_right">
					<view class="gpsAndCall">
						<view class="gpsAndCall_item" @click.stop="handleCall(0)" v-if="
							elevatorDetail.estateUserList &&
							elevatorDetail.estateUserList.length
						">
							<image src="@/static/images/phone3.png" mode=""></image>
							<view>物业</view>
						</view>
						<view class="gpsAndCall_item guide" @click.stop="handleGuide">
							<image src="@/static/images/locations.png" mode=""></image>
							<view>导航</view>
						</view>
						<view class="line" v-if="
							elevatorDetail.estateUserList &&
							elevatorDetail.estateUserList.length
						"></view>
					</view>
				</view>
			</view>
			<view class="content_box" :style="{ zIndex: showBg ? '100' : '105' }">
				<view class="progressBar">
					<view class="progressBar_content">
						<view class="progressBar_item">
							<view class="finishDateContent" v-if="status == 3">
								<view class="label">预计维修结束时间</view>
								<view class="timeArea" @click="showChooseDate" v-if="dateArr.length">
									<text>{{ `${dateArr[0]}年` }}</text>
									<text class="timeStr">
										{{ `${dateArr[1]}月${dateArr[2]}日` }}
										<text v-if="todayStr">{{ `(${todayStr})` }}</text>
										{{ `${dateArr[3]}:${dateArr[4]}` }}
									</text>

									<image v-if="!isCreateFrom" src="@/static/images/edit2.png" mode="" />
								</view>
							</view>
							<stautsStep :actIndex="[-1, 0, 1, 2, 1, 2, 3][status - 1]" :list="options" :log="logs">
							</stautsStep>
						</view>
						<view :style="{
							padding: (planDetail.users || []).some(
								(item) => item.createFrom === 1
							)
								? '20rpx 0 52rpx 0'
								: '20rpx 0',
						}" @click="goTaskSetpPage">
							<user-list lable="维修人员" :list="planDetail.users"></user-list>
						</view>
					</view>
				</view>
				<!-- maintainPlanContentExt 评分信息Obj -->
				<view class="content_item"
					v-if="planDetail.maintainPlanContentExt && planDetail.maintainPlanContentExt.scoreStatus">
					<view class="title">工单评分</view>
					<view class="falutItem">
						<view class="label">有效判定</view>
						<view :style="{
							color: planDetail.maintainPlanContentExt.scoreType == 1 ? '#68CA00' :
								planDetail.maintainPlanContentExt.scoreType == 2 ? '#E02020' :
									'#333333'
						}">
							{{ planDetail.maintainPlanContentExt.scoreType == 1 ? '有效工单' :
								planDetail.maintainPlanContentExt.scoreType == 2 ? '无效工单' :
									'无法判断'
							}}
						</view>
					</view>
					<view class="falutItem" v-if="planDetail.maintainPlanContentExt.scoreType == 2">
						<view class="label">无效原因</view>
						<block v-for="(item, index) in planDetail.maintainPlanContentExt.scoreFutilityDesc.split(',')"
							:key="index">
							<text class="status normal marginTop">
								{{ item }}
							</text>
						</block>
					</view>
					<view class="falutItem" v-if="planDetail.maintainPlanContentExt.scoreFutilityOtherDesc">
						<view class="label">其他原因</view>
						<view>
							{{ planDetail.maintainPlanContentExt.scoreFutilityOtherDesc }}
						</view>
					</view>
					<view class="falutItem">
						<view class="label">评分备注</view>
						<view>
							{{ planDetail.maintainPlanContentExt.scoreRemark || '/' }}
						</view>
					</view>
				</view>
				<view class="content_item">
					<view class="title">任务信息</view>
					<view class="falutItem">
						<view class="label">任务类型</view>
						<view class="status normal">
							{{ workOrderDetail.workOrderTypeName || '' }}
						</view>
						<view v-if="workOrderDetail.sourcePlanType" class="status normal">
							{{ workOrderDetail.sourcePlanTypeName || '' }}
						</view>
					</view>
					<view class="falutItem">
						<view class="label">紧急程度</view>
						<block v-for="(item, index) in btnBoxList" :key="index">
							<text class="tag" v-if="workOrderDetail.emerProcType == item.key"
								:style="{ color: item.color, borderColor: item.color }">
								{{ item.label }}
							</text>
						</block>
					</view>
					<view class="falutItem">
						<view class="label">报障电梯状态</view>
						<view :class="[
							'status',
							workOrderDetail.elevatorStop == 1 ? 'normal' : 'stops',
						]">
							{{ workOrderDetail.elevatorStop == 1 ? "正常运行" : "停梯" }}
						</view>
					</view>
					<view class="falutItem">
						<view class="label">计划执行时间</view>
						<view>{{
							workOrderDetail.planDate
								? workOrderDetail.planDate.split(" ")[0].replaceAll("-", "/")
								: "/"
						}}</view>
					</view>
					<view class="falutItem">
						<view class="label">计划完成时间</view>
						<view>{{
							workOrderDetail.planFinishDate
								? workOrderDetail.planFinishDate
									.split(" ")[0]
									.replaceAll("-", "/")
								: "/"
						}}</view>
					</view>
				</view>
				<view class="content_item noPadding" v-for="(item, index) in workOrderDetail.faultMessageList"
					:key="index">
					<view class="des">
						<view class="flexBox" v-if="item.partsIds && item.partsIds != 0">
							<view class="title">
								<text class="promTit">故障部件</text>
								<text class="numberTag">{{
									workOrderDetail.faultMessageList[0].problemItemNames ||
										(workOrderDetail.faultMessageList[0].partsIds == 0 &&
											!workOrderDetail.faultMessageList[0].problemItemNames)
										? index
										: index + 1
								}}</text>
							</view>
							<view class="btn" v-if="
								item.status != 1 &&
								workOrderDetail.updateStatus &&
								item.malfunctionRecordVO &&
								item.malfunctionRecordVO.length &&
								userinfo.user_id == item.createUserId &&
								showBtn(item) &&
								!isCreateFrom
							">
								<image src="@/static/images/edit2.png" @click="updateParts(item)">
								</image>
								<block v-if="status !== 4">
									<view class="btnView"></view>
									<image src="@/static/images/del.png" @click="delParts(item)">
									</image>
								</block>
								<block v-if="
									status === 4 && workOrderDetail.faultMessageList.length > 2
								">
									<view class="btnView"></view>
									<image src="@/static/images/del.png" @click="delParts(item)">
									</image>
								</block>
							</view>
						</view>
						<view class="des_buttonBox" v-if="
							item.partsIds &&
							item.partsIds != 0 &&
							workOrderDetail.updateStatus &&
							!isCreateFrom
						">
							<view v-if="status > 2 && status != 4 && findRoute('add_parts')"
								:class="item.structureType === 1 ? 'btn-disabled' : ''" class="des_buttonBox_item"
								@click="handleAdd(item)">
								申请配件</view>
							<view v-if="status > 2" class="des_buttonBox_item" :class="[item.emptyRecord ? 'red' : '']"
								@click="addRecord(item)">添加维修记录
							</view>
							<view v-if="status > 2" class="des_buttonBox_item"
								:class="[item.proofReasonBox ? 'red' : '']" :style="{
									opacity: !(
										item.faultReasonItemNames &&
										item.faultReasonItemNames.length
									)
										? '1'
										: '0',
								}" @click="addReason(index, item)">添加维修结果</view>
						</view>
						<view class="descBox" v-if="item.partsIds && item.partsIds != 0">
							<view class="title">故障部件</view>
							<view class="descBox_label">
								{{ item.partsName }}
								<text v-if="item.partsName && item.floorStandNames">({{
									item.floorStandNames.replaceAll(',', '>') }})</text>
							</view>
						</view>
						<view class="flexBox proDesc" v-else>
							<view class="title proDescTitle">故障现象</view>
						</view>
						<view class="descBox noPadding" v-if="item.problemItemNames && item.problemItemNames.length">
							<view class="title">故障现象</view>
							<view class="status_content">
								<view :class="['status', 'normal']" v-for="(it, i) in item.problemItemNames" :key="i">
									{{ it }}
								</view>
							</view>
						</view>
						<view class="descBox" v-if="
							item.problemItemNames && item.problemItemNames.includes('其他')
						">
							<view class="title">其他故障现象</view>
							<view class="content">{{ item.problemOtherDesc }}</view>
						</view>
						<view class="descBox" v-if="item.mfDesc">
							<view class="title">故障描述</view>
							<view class="descItem">
								<text class="content" v-if="showDescBtn">{{
									item.mfDesc
								}}</text>
								<text class="content noWrap" v-else>{{
									JSON.stringify(item.mfDesc)
										.split("\\n")
										.slice(0, 2)
										.join("\n")
										.slice(1)
								}}</text>
								<text v-if="showDesc(item)" class="desBnt" @click="showDescBtn = !showDescBtn">
									{{ showDescBtn ? "收起" : "展开" }}
								</text>
							</view>
						</view>
						<view class="descBox" v-if="item.mfImgUrl && item.mfImgUrl.length">
							<view class="title">故障图片</view>
							<view class="descItem">
								<image-drag-sort :disabled="true" :list="item.mfImgUrl"></image-drag-sort>
							</view>
						</view>
						<view class="descBox">
							<view class="title">创建人</view>
							<view class="content">{{
								item.createUserName + " " + item.msgCreateTime
							}}</view>
						</view>
						<view :class="['descBox', `reasonBox${index + 1}`]">
							<view class="des_content">
								<repair-record :class="[`repairRecord${index}`]"
									v-for="(it, idx) in filterateList(item)" :key="it.id" :isPlanStatus="isPlanStatus"
									:typeObject="{
										workOrderType: workOrderDetail.workOrderType,
										emerProcType: workOrderDetail.emerProcType,
									}" :msg="it" :index="idx" :filterateList="filterateList(item)" :order-status="status" :planId="planId"
									:elevatorId="elevatorId" :planDetailUserArr="planDetail.users"
									:update-status="workOrderDetail.updateStatus"
									@changeEditStatus="editingRecord(item, $event)" @update="updateRecord"
									@hadDone="handleDone"></repair-record>

								<view class="repari_result_new" v-if="
									item.faultReasonItemNames &&
									item.faultReasonItemNames.length
								">
									<view class="top">
										<view class="resultTitle">维修结果</view>
										<view class="handle">
											<view class="handle_item"
												v-if="workOrderDetail.updateStatus && !isCreateFrom">
												<view @click="addReason(index, item, 1)" class="editBtn">
													<image src="@/static/images/edit2.png" mode=""></image>
												</view>
												<view v-if="status != 4" @click="handleDel(item)" class="delBtn">
													<image src="@/static/images/del.png" mode=""></image>
												</view>
											</view>
										</view>
									</view>
									<view class="descBox falsutBox" v-if="
										item.faultReasonItemNames &&
										item.faultReasonItemNames.length
									">
										<view class="title">故障原因</view>
										<view class="status_content">
											<view :class="['status', 'stops']"
												v-for="(it, i) in item.faultReasonItemNames" :key="i">
												{{ it }}
											</view>
										</view>
									</view>
									<view class="descBox" v-if="item.faultReasonOtherDesc">
										<view class="title">其他故障原因</view>
										<view class="content">{{ item.faultReasonOtherDesc }}</view>
									</view>
									<view class="descBox" v-if="item.partsOpe">
										<view class="title">配件更换</view>
										<view class="content">{{
											partList.find((v) => v.value == item.partsOpe).label
										}}</view>
									</view>
									<view class="descBox" v-if="item.faultDesc">
										<view class="title">故障说明</view>
										<view class="content">{{ item.faultDesc }}</view>
									</view>
									<view class="descBox falsutBox" v-if="item.faultImg && item.faultImg.length">
										<view class="title"></view>
										<view class="content">
											<image-drag-sort :max="9" :list="item.faultImg" :disabled="true">
											</image-drag-sort>
										</view>
									</view>
									<view class="descBox" v-if="
										item.malfunctionRecordVO &&
										item.malfunctionRecordVO.length > 0
									">
										<view class="title">创建人</view>
										<!-- updateTime updateUserName -->
										<view class="content">{{
											item.faultSubmitUserName + " " + item.faultSubmitTime
										}}
										</view>
									</view>
								</view>
								<view class="repari_result_new partTask"
									v-if="item.correlationList && item.correlationList.length">
									<view class="top">
										<view class="resultTitle">配件任务</view>
									</view>
									<view class="correlationBox" v-for="(it, i) in item.correlationList" :key="i"
										@click="toDetail(it)">
										<view class="correlationBox_row">
											<view class="left">
												<text class="correlationBox_row_title">关联任务: </text>
												<text>{{ it.id }}</text>
												<text class="correlationBox_row_tag">{{
													it.typeStatusName
												}}</text>
											</view>
											<view class="right">
												<text>查看</text>
												<uni-icons color="#999" size="18" type="arrowright" />
											</view>
										</view>
										<!-- it.auditStatusName   it.planStatusName -->
										<view class="correlationBox_row">
											<view class="correlationBox_row_title">任务状态:</view>
											<view class="correlationStatus">
												<view class="correlationBox_row_maxTag" :style="{
													color: resNameColor(
														it.auditStatus == 5 ? 99 : it.status
													).color,
													border:
														'2rpx solid ' +
														resNameColor(it.auditStatus == 5 ? 99 : it.status)
															.color,
												}">{{
													resNameColor(it.auditStatus == 5 ? 99 : it.status)
														.name
												}}</view>
												<view class="correlationBox_row_maxTag"
													v-if="![1, 8, 9].includes(it.status)" :style="{
														color: planStatusArr.find(
															(v) => v.value === it.status
														).color,
														border:
															'2rpx solid ' +
															planStatusArr.find((v) => v.value === it.status)
																.color,
													}">{{
														planStatusArr.find((v) => v.value === it.status)
															.name
													}}</view>
											</view>
										</view>
									</view>
								</view>
							</view>
						</view>
					</view>
				</view>

				<view class="content_item">
					<view class="title">报障信息</view>
					<view class="msg_box">
						<view class="msg_box_label">报障人</view>
						<view v-if="workOrderDetail.faultMessageList && workOrderDetail.faultMessageList.length">{{
							workOrderDetail.faultMessageList[0].name }}</view>
					</view>
					<view class="msg_box">
						<view class="msg_box_label">报障电话</view>
						<view v-if="workOrderDetail.faultMessageList && workOrderDetail.faultMessageList.length">{{
							workOrderDetail.faultMessageList[0].phone }}</view>
					</view>
					<view class="msg_box">
						<view class="msg_box_label">报障渠道</view>
						<view v-if="workOrderDetail.faultMessageList && workOrderDetail.faultMessageList.length">{{
							workOrderDetail.faultMessageList[0].planFromName }}</view>
					</view>
					<view class="msg_box">
						<view class="msg_box_label">报障单位</view>
						<view>{{ workOrderDetail.faultReportVO.faultCompany }}</view>
					</view>
					<view class="msg_box">
						<view class="msg_box_label">报障时间</view>
						<view>{{ workOrderDetail.faultReportVO.createTime }}</view>
					</view>
				</view>

				<!-- 最近一次维修保养 -->
				<view class="content_item" v-if="isFromHistory != 2 && workOrderDetail.lastPlan">
					<last-record :msg="{ ...workOrderDetail.lastPlan, ...elevatorDetail }"></last-record>
				</view>
				<!-- S- 关闭原因 -->
				<view class="content_item" v-if="
					workOrderDetail.faultMessageList &&
					workOrderDetail.faultMessageList.length > 0 &&
					workOrderDetail.faultMessageList[0].closeDesc
				">
					<view class="title">关闭原因</view>
					<view class="close_desc">
						<view class="close_desc_item">
							{{ workOrderDetail.faultMessageList[0].closeDesc }}
						</view>
						<view class="close_desc_cont">{{
							workOrderDetail.faultMessageList[0].closeUserName +
							" " +
							workOrderDetail.faultMessageList[0].updateTime
						}}
						</view>
					</view>
				</view>
				<!-- E- 关闭原因 -->
			</view>
			<!-- 底部部分 -->
			<!-- 开始维修按钮放开 -->

			<view class="bottom" v-if="
				isFromHistory == 1 &&
				(status == 2 || (status == 3 && userSignCount == 0))
			">
				<view class="right flex">
					<view class="start flex" @click="handleStart">开始维修 </view>
				</view>
			</view>
			<!-- 状态是维修中且签到过展示以下按钮 -->
			<view class="bottom" v-if="
				isFromHistory == 1 &&
				showBtns &&
				status >= 3 &&
				userSignCount > 0 &&
				!isCreateFrom
			">
				<view class="right flex">
					<view v-if="status == 1">
						<view class="start flex grey" v-if="status == 1">工单待审批</view>
						<view class="start flex grey" v-if="status == 5 || status == 6">工单已关闭</view>
					</view>

					<!-- <view class="start flex" v-if="status == 2 || (status == 3 && userSignCount == 0)" @click="handleStart">开始维修
        </view> -->
					<block>
						<view class="repariing flex" v-if="status == 3 && userSignCount > 0">
							<view class="add addRed" v-if="userSignCount != 0" @click="toAddPart">配件更换记录
								<text v-if="partsCounts > 0">{{ partsCounts }}</text>
							</view>
							<view class="add" v-if="userSignCount != 0" @click="addWork">添加-故障部件</view>
							<view @click="handleFinsh(true)" v-if="userSignCount != 0">
								<view class="add" v-if="openReport"> 完成并确认报告 </view>
								<view class="add" v-else> 维修完成 </view>
							</view>
						</view>
						<!-- 添加-故障部件 -->
						<view class="repariing flex" v-if="status == 4">
							<view class="add addRed" v-if="userSignCount != 0" @click="toAddPart">配件更换记录
								<text v-if="partsCounts > 0">{{ partsCounts }}</text>
							</view>
						</view>
						<view class="repariing flex" v-if="status == 4 && workOrderDetail.updateStatus">
							<view class="add" v-if="
								userSignCount != 0 ||
								(status == 4 && workOrderDetail.updateStatus)
							" @click="addWork">添加-故障部件</view>
						</view>
						<template v-if="openReport">
							<view class="start flex" v-if="status === 4 && !workOrderDetail.reportId">
								<view class="add" v-if="!workOrderDetail.reportId" @click="previewReport">确认报告并发送</view>
							</view>
							<view class="start flex" v-if="status === 4 && workOrderDetail.reportId">
								<view class="add" v-if="workOrderDetail.reportId" @click="checkReport">查看维修报告</view>
							</view>
						</template>
						<template v-else>
							<view class="start flex grey" v-if="status === 4">
								<view class="finBtn">已完成</view>
							</view>
						</template>
					</block>
				</view>
			</view>

			<!-- 项目别名弹窗 -->
			<aliasPopup :showAlias="popupShow" :aliasArr="aliasArr" @closedMask="closedMask"></aliasPopup>

			<!-- 电梯状态弹窗 -->
			<model title="请选择电梯状态" :maskClick="false" @cancle="cancleChange" @comfire="comfireChange"
				:visible="visibleEleStatus">
				<view class="change_elevator">
					<view @click="changeElevator(1)" :class="elevatorStatus === 1 ? 'actElevator' : ''">正常运行</view>
					<view @click="changeElevator(2)" :class="elevatorStatus === 2 ? 'actElevator' : ''">停梯</view>
				</view>
			</model>
			<!-- 维修记录 -->
			<uni-popup ref="popup" :mask-click="true" type="bottom" @close="closeRecord" @updata="updataShowFuc">
				<add-record v-if="showPoupup" ref="addRecord" @addRecord="handleSubmit" :plan-id="planId"
					:worksId="worksId" @update="handleSubmit" :restFlag="aa" :setPartMsg="addRecordMsg"
					@hadDone="handleDone" @showExample="showExample"></add-record>
			</uni-popup>
			<!-- 添加处理结果 -->
			<uni-popup ref="finish" :mask-click="true" type="bottom">
				<reason-model @cancle="handleReasonClose" :list="reasonList" :other-id="otherId"
					@comfire="handleReasonComfire" ref="reason" @showExample="showExample"></reason-model>
			</uni-popup>
			<!-- 修改故障部件 -->
			<uni-popup ref="updateParts" :mask-click="true" type="bottom">
				<view class="repari_result repari_result_new">
					<view class="line"><text></text></view>
					<view class="top">
						<view>修改-故障部件</view>
					</view>
					<view class="content_item">
						<view class="name">故障部件
							<text>*</text>
						</view>
						<repair-fitting :elevatorId="elevatorId" @repairFit="getPart"
							ref="repairFitting"></repair-fitting>
					</view>
					<view class="notice">
						<view class="name">
							<view>故障描述</view>
							<text>*</text>
						</view>
						<view class="area" :style="{
							borderColor: formError.includes('mfDesc') ? '#e02020' : '',
						}">
							<textarea v-model="updateMsg.mfDesc" :placeholder="formFocus === 'mfDesc' ? '' : '示例：厅门无法正常闭合'
								" placeholder-class="textare" maxlength="200" :always-embed="true" @blur="
									(formFocus = ''),
									updateMsg.mfDesc ? '' : formError.push('mfDesc')
									" @focus="
										formError.includes('mfDesc') &&
										formError.splice(formError.indexOf('mfDesc'), 1),
										(formFocus = 'mfDesc')
										" />
							<view class="length">{{
								(updateMsg.mfDesc ? updateMsg.mfDesc.length : "0") + "/200"
							}}</view>
						</view>
						<view class="error" v-if="formError.includes('mfDesc')">请输入故障描述</view>
					</view>
					<view class="imgBox">
						<view class="name">故障部件-图片/视频
							<text>*</text>
						</view>
						<image-drag-sort :max="9" @changeList="changeImgUrl" :list="updateMsg.partImg">
						</image-drag-sort>
					</view>
					<view class="save"><button hover-class="none" @click="handleSave">确定</button></view>
				</view>
			</uni-popup>
			<!-- 删除处理结果 弹窗提示 -->
			<model title="删除提示" comfireTxt="确定" :maskClick="false" @cancle="resultDelVisible = false"
				@comfire="comDelResult" :visible="resultDelVisible">
				<view class="delRepairRec">是否确定删除维修结果相关信息？</view>
			</model>
			<!-- 删除故障部件 弹窗提示 -->
			<model title="删除提示" comfireTxt="确定" :maskClick="false" @cancle="partVisible = false" @comfire="comDelPart"
				:visible="partVisible">
				<view class="delPartBox">
					<view class="content">是否确定删除故障部件等相关信息？</view>
					<view class="subContetn">
						<view v-if="updatePartsItem.partsIds">
							{{
								updatePartsItem.partsName.split(">")[
								updatePartsItem.partsName.split(">").length - 1
								]
							}}
						</view>
						<view>{{ updatePartsItem.partsName }}</view>
					</view>
				</view>
			</model>
			<!-- 弹窗提示 -->
			<model title="完成提示" comfireTxt="查看配件更换" :maskClick="false" @cancle="visibleShow = false" @comfire="comfire"
				:visible="visibleShow">
				<view class="comfireBox">
					<view>当前维修任务下，还有未完成的配件更换，无法结束任务</view>
					<view class="content">注:请点击查看配件更换，查看具体任务</view>
				</view>
			</model>
			<!-- 提示上次签到弹框 -->
			<model :title="signType == 'in' ? '签到拍照提示' : '签退拍照提示'" :maskClick="false" @cancle="comfireUseLastImg(false)"
				@comfire="comfireUseLastImg(true)" :visible="visibleShowTwo">
				<view class="lastImg">
					{{
						`是否使用上次${signType == "in"
							? workOrderDetail && workOrderDetail.lastSignImg && workOrderDetail.lastSignImg.signTime
							: workOrderDetail && workOrderDetail.lastSignImg && workOrderDetail.lastSignImg.signOutTime
						}【${signType == "in"
							? workOrderDetail && workOrderDetail.lastSignImg && workOrderDetail.lastSignImg.signTypeStatusDesc
							: workOrderDetail && workOrderDetail.lastSignImg &&
							workOrderDetail.lastSignImg.signOutTypeStatusDesc
						}工单】的${signType == "in" ? "签到" : "签退"}拍照?`
					}}
				</view>
			</model>

			<!-- 时间选择 -->
			<week-year-date ref="weekYear" :showState="showState" @selectChange="selectChange"
				@bindClose="bindClose"></week-year-date>
			<!-- 物业电话 -->
			<property-phone ref="property" @bindClose="closePhone"
				:list="elevatorDetail.estateUserList"></property-phone>
			<view class="signCircle" v-if="status == 3 && userSignCount != 0 && !isCreateFrom"
				:style="{ left: movable.x + 'px', top: movable.y + 'px' }" @touchmove.stop="movableChange"
				@touchend="touchend">
				<view class="add" @click.stop="showStatusChangeBeforeLeave('')" v-if="isPlanStatus">签退</view>
				<view class="add" v-if="!isPlanStatus" @click="handleStart">{{ "继续" }}
				</view>
			</view>

			<!-- 有未签退的工单 -->
			<model title="有未签退的维修任务" :maskClick="false" comfireTxt="去签退" width="500rpx" :showCloseIcon="false"
				@cancle="signOutModelVisible = false" @comfire="toNotSignOutOrder" :visible="signOutModelVisible">
				<not-sign-out-model :msg="checkCanSignOutMsg"></not-sign-out-model>
			</model>

			<!-- 添加-故障部件 -->
			<uni-popup ref="addWork" :mask-click="true" type="bottom" @change="$refs.addWorkContent.clear()">
				<addWork ref="addWorkContent" :status="status" :workOrderDetail="workOrderDetail"
					:disabledArr="disabledArr" :reasonList="reasonList" :other-id="otherId" :planId="planId"
					@add="fulfil" @showExample="showExample">
				</addWork>
			</uni-popup>
			<!-- 表单填写-示例-S -->
			<uni-popup ref="examplePopup" :mask-click="false">
				<add-example :exampleType="exampleType"
					@closeExample="$refs.examplePopup.close(), (exampleType = '')"></add-example>
			</uni-popup>
		</view>
		<previewMedia ref="previewMedia"></previewMedia>
		<aiCustomer v-if="findRoute('Airobot')"></aiCustomer>
	</view>
</template>

<script>
import aiCustomer from '../components/ai-customer/ai-customer.vue';
import RepairFitting from '@/components/repairFitting/repairFitting.vue';
import ImageDragSort from '@/components/image-drag-sort/img-and-video.vue';
import ReasonModel from './components/reason-model.vue';
import addWork from './components/add-work.vue';
import stautsStep from '@/components/status-special/status-special.vue';
import ElevtorCard from '@/subpages/repair/components/elevtor-card.vue';
import LastRecord from '@/components/last-record/last-record.vue';
import UserList from '@/components/user-list/user-list.vue';
import model from '@/components/model/index.vue';
import GlobalNavBar from '@/components/uni-nav-bar/global-nav-bar';
import WeekYearDate from '@/components/dateSelect/index.vue';
import PropertyPhone from '@/components/propertyPhone/index.vue';
import NotSignOutModel from '../components/notSignOutModel/index.vue';
import aliasPopup from '@/components/card-dial/aliasPopup.vue';
import {
	getPlanDetail,
	finishPlan,
	getWorkPartList,
} from '@/apis/workOrder.js';
import { getDerviceTime } from '@/apis/system';
import { getSelectWorkTracks } from '@/apis/taskStepPage.js';
import {
	fetchDetail,
	finish,
	falutReason,
	getPartListCounts,
	getReportCountByRepair,
	getReportConfig,
} from '@/apis/repair.js';
import { mapState, mapActions } from 'vuex';
import {
	elevtorDetail,
	changeElevatorState,
	changeElevatorStoplog,
} from '@/apis/elevator.js';
import { getDistance } from '@/utils/tools.js';
import { getlocalinfo, getBeforeDate } from '@/utils/utils.js';
import { timeUpdate, getConfig, checkCanSignOut } from '@/apis/sign.js';
import dayjs from 'dayjs';
import {
	submitWork,
	removeWork,
	getRemoveResult,
} from '@/apis/barrierSearch.js';
import { editCHeckRecord } from '@/apis/workOrder.js';
import { hanleToken } from '@/utils/utils.js';
export default {
	components: {
		GlobalNavBar,
		aiCustomer,
		model,
		stautsStep,
		ElevtorCard,
		LastRecord,
		ImageDragSort,
		ReasonModel,
		UserList,
		WeekYearDate,
		PropertyPhone,
		NotSignOutModel,
		aliasPopup,
		RepairFitting,
		addWork,
		addExample,
	},
	data() {
		return {
			// 展开收起 具体描述
			showDescBtn: true,
			updateMsg: {
				partImg: [],
			},
			disabledArr: [],
			resultDelVisible: false,
			partVisible: false,
			updatePartsItem: {},
			// 故障部件记录id
			worksId: '',
			showchangeTips: false,
			// 顶部导航栏title
			navBarTitle: '',
			// 有配件更换未完成弹窗
			visibleShow: false,
			// 工单详情
			workOrderDetail: {
				// 故障信息
				faultMessageList: {},
				// 报障信息
				faultReportVO: {},
				// 处理结果
				faultReasonVO: {},
				// 维修详情最后一次任务
				lastPlan: {},
				malFunctionHistories: [],
				planContentUsers: [],
				// 未完成的配件更换数量
				partsCount: 0,
			},
			signType: 'in',
			elevatorId: '',
			// 任务状态详情
			planDetail: {},
			// 我自己是否还未签退
			isPlanStatus: false,
			userSignCount: 0,
			showPoupup: false,
			options: [
				{
					status: 2,
					name: '待开始',
					icon: '/static/images/step1.png',
					createTime: '',
				},
				{
					status: 3,
					name: '维修中',
					icon: '/static/images/step2.png',
					createTime: '',
				},
				{
					status: 4,
					name: '已完成',
					icon: '/static/images/step3.png',
					createTime: '',
				},
			],
			signinData: {},
			// signImg: [], // 签到图片
			status: '',
			elevatorDetail: {},
			elevatorStop: '',
			imgUrl: [],

			malFunctionHistories: [],
			planId: '',
			lastPlan: {},
			showBg: false,
			imgaddress: '',
			stepList: [],
			isFull: false,
			logs: [],
			reasonList: [],
			faultReasonVO: {},
			// 是否在历史详情页面跳转过来,否type=1 是type=2
			isFromHistory: '1',
			otherId: '',
			problemOtherDesc: '',
			// 配件更换数量
			partsCounts: 0,
			// 配件已完成数量
			finishCounts: 0,
			visibleShowTwo: false,
			// 改变电梯状态
			visibleEleStatus: false,
			elevatorStatus: 1,
			// 维修完成提示处理结果状态弹窗
			isOUtInState: false,
			// 有同伴任务数据
			cantUsersArr: [],
			// 确定电梯状态后是否走签退逻辑
			showLeave: false,
			// 签退后是否走维修完成逻辑
			handFinish: false,
			dateArr: [],
			// 预计完成时间
			finishDate: '',
			showState: false,
			// 是否填充照片
			useLastImg: false,
			config: {},
			// 24小时内是否可以编辑
			updateStatus: false,
			movable: {
				x: 320,
				y: 0,
				height: 0,
				width: 0,
			},
			isLeftBackShow: true,
			// 区分按钮类型发送群消息
			buttonType: null,
			signOutModelVisible: false,
			// 未签退的工单信息
			checkCanSignOutMsg: {},
			reasonIndex: '0',
			popupShow: false,
			overflowShow: false,
			aliasArr: [],
			recordLog: '创建',
			btnBoxList: [
				// 紧急程度标签
				{ color: '#0091FF', bgColor: '#dcf0ff', label: '较低', key: '4' },
				{ color: '#F7B500', bgColor: '#fff7e1', label: '普通', key: '3' },
				{ color: '#fa6400', bgColor: '#ffecdf', label: '紧急', key: '2' },
				{ color: '#e02020', bgColor: '#ffecec', label: '非常紧急', key: '1' },
			],
			planStatusArr: [
				{ name: '待审核', value: 0, color: '#0091FF' },
				{ name: '信息审核', value: 1, color: '#0091FF' },
				// { name: '待报价', value: 2, color: '#0091FF' },
				// { name: '待回签', value: 10, color: '#0091FF' },
				{ name: '销售生单', value: 2, color: '#0091FF' },
				{ name: '销售生单', value: 10, color: '#0091FF' },
				// { name: '待采购', value: 11, color: '#0091FF' },
				{ name: '待发货', value: 11, color: '#0091FF' },
				{ name: '待发货', value: 3, color: '#0091FF' },
				{ name: '待签收', value: 12, color: '#0091FF' },
				{ name: '待分配', value: 4, color: '#0091FF' },
				{ name: '待更换', value: 5, color: '#0091FF' },
				{ name: '更换中', value: 6, color: '#0091FF' },
				{ name: '已完成', value: 7, color: '#16BF99' },
				{ name: '已关闭', value: 8, color: '#999999' },
				{ name: '已撤回', value: 9, color: '#999999' },
			],
			examineArr: [
				{ name: '审核中', color: '#FA6400', arrStatus: [1, 2, 3] },
				{ name: '审核不通过', color: '#E02020', arrStatus: [8] },
				{
					name: '审核通过',
					color: '#16BF99',
					arrStatus: [4, 5, 6, 7, 10, 11, 12],
				},
				{ name: '已撤回', color: '#999999', arrStatus: [9] },
				{ name: '审核退回', color: '#999999', arrStatus: [99] },
			],
			// addRecord-restFlag
			aa: '',
			addRecordMsg: null,
			// 示例组件选中的类型
			exampleType: 0,
			// 是否启用返回报告提示 1：关闭。2启用
			judge: 1,
			// 是否启用维修报告
			openReport: true,
			partList: [
				{
					value: 1,
					label: '无需更换',
				},
				{
					value: 2,
					label: '建议更换',
				},
				{
					value: 3,
					label: '已更换',
				},
			],
			formFocus: '',
			formError: [],
			showMsgFlag: false,
			preObj: {},
		};
	},

	async onLoad(e) {
		this.preObj = e;
		this.showMsgFlag = false;
		console.log('维修任务', e);
		this.navBarTitle = this.isFromHistory === '1' ? '维修任务' : '维修记录';
		this.planId = e.planId;
		this.elevatorId = e.elevatorId;
		if (Number(e.typePage) === 1) {
			// 接收配件详情页跳转隐藏返回箭头
			this.isLeftBackShow = false;
		}
		try {
			// this.showchangeTips = await getRobotStatusFuc(this.elevatorId);
		} catch (error) {
			console.log(error);
		}
		if (e.type) {
			this.isFromHistory = e.type;
		}
		await this.handleRreshToken();
		uni.$on('isFinsh', async (res) => {
			console.log(res, 'isFinsh');
			if (res == true) {
				await this.initData();
				this.handleFinsh();
			}
		});
		await this.onGetReportConfig();
		// 进入电子围栏显示弹窗
		if (e.state == 'STATUS_IN' || e.state == 'STATUS_OUT') {// 签到签退弹窗
			this.funcModelShow(true, e.state);
		}
	},
	onUnload() {
		// 卸载返回提示
		if (this.openReport && this.status === 4) {
			// wx.disableAlertBeforeUnload({
			// 	success: (res) => {
			// 		console.log(res, 'disableAlertBeforeUnload-res');
			// 	},
			// 	fail: (err) => {
			// 		console.log(err, 'disableAlertBeforeUnload-err');
			// 	},
			// });
		}

		uni.$off('isFinsh');
	},
	async onShow() {
		await this.handleRreshToken();
		if (!this.userinfo.user_id) {
			uni.showModal({
				title: '提示',
				content: '检测到您未登录或登录已失效，请前往登录后在操作',
				showCancel: false,
				success: () => {
					uni.navigateTo({
						url: '../login/index',
					});
				},
			});
			return;
		}
		await this.initData();
		// 判断是否已关闭和不是执行人
		// 判断工单是否是执行人
		console.log(this.status, 'status的值');
		let user = this.workOrderDetail.planContentUsers;
		let isIncludes = user.findIndex(
			(item) => item.userId == this.userinfo.user_id
		);
		console.log(user, 'user得知', isIncludes);
		let type = 1;
		if (this.status == 7 || isIncludes == -1) {
			console.log('看看这里');
			if (isIncludes == -1) {
				type = 2;
			}
			if (this.status == 7 && isIncludes == -1) {
				// eslint-disable-next-line no-unused-vars
				type = 1;
			}
		}
		if (this.status == 4 && this.openReport && !this.showMsgFlag) {
			await this.onGetReportCountByRepair();
			if (!this.workOrderDetail.reportId) {
				this.showMsgFlag = true;
				uni.showModal({
					title: '维修报告发送提醒',
					content: '检测到尚未发送维修报告，请确认报告无误后立即发送',
					confirmText: '立即确认',
					cancelColor: '#999999',
					confirmColor: '#0091ff',
					success: (res) => {
						if (res.confirm) {
							console.log('用户点击确定');
							this.showMsgFlag = false;
							uni.navigateTo({
								url: '/subpages/repair/reportEdit?planId=' + this.planId,
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					},
				});
			}
		}
	},
	mounted() {
		wx.getSystemInfo({
			success: (res) => {
				console.log('system', res);
				this.movable.height = res.windowHeight - 100;
				this.movable.y = res.windowHeight - 240;
				this.movable.width = res.windowWidth;
				this.movable.x = this.movable.width - 55;
			},
		});
	},
	watch: {
		// malFunctionHistories(val) {
		//   console.log(val, "val的值");
		//   if (val.length) {
		//     this.emptyRecord = false;
		//   }
		// },
	},
	computed: {
		...mapState('user', ['userinfo']),
		showBtns() {
			let next = false;
			if (!this.planDetail.users) {
				return next;
			}
			for (let i = 0; i < this.planDetail.users.length; i++) {
				if (this.planDetail.users[i].userId == this.userinfo.user_id) {
					next = true;
					break;
				}
			}
			console.log(next, 'next的值');
			return next;
		},
		// 判断自己转出的单不可编辑
		isCreateFrom() {
			return (this.planDetail.users || []).some(
				(item) => item.userId == this.userinfo.user_id && item.createFrom === 2
			);
		},
		finishBtn() {
			return this.malFunctionHistories.length ? false : true;
		},

		todayStr() {
			let today = getBeforeDate(0);
			let tomorrow = getBeforeDate(-1);
			let afterTomorrow = getBeforeDate(-2);
			let str = this.finishDate.substring(0, 10);
			if (str == today) {
				return '今天';
			} else if (str == tomorrow) {
				return '明天';
			} else if (str == afterTomorrow) {
				return '后天';
			} else {
				return '';
			}
		},
	},
	onPageScroll(e) {
		// console.log(e.scrollTop, '滚动')
		if (e.scrollTop > 20) {
			this.navBarTitle = this.elevatorDetail.elevatorAddress;
			this.scrollTop = e.scrollTop;
			this.showBg = true;
		} else {
			this.navBarTitle = this.isFromHistory === '1' ? '维修任务' : '维修记录';
			this.showBg = false;
		}
	},
	methods: {
		...mapActions('user', ['handleRreshToken']),
		resNameColor(pStatus) {
			return (
				this.examineArr.find((item) => item.arrStatus.includes(pStatus)) || {}
			);
		},
		// 判断具体描述 是否展示 收起展开操作
		showDesc(row) {
			if ((JSON.stringify(row.mfDesc).match(/\\n/g) || []).length >= 2) {
				return true;
			}
			return false;
		},
		// 查看关联任务
		toDetail(row) {
			uni.navigateTo({
				url: '/subpages/approve/partApprovalDetail?type=3&&id=' + row.id,
			});
		},
		// 申请配件
		handleAdd(row) {
			// structureType 结构类别 0-配件，1-位置
			// 位置的配件话置灰不给申请配件
			if (row.structureType === 1) {
				return;
			}
			if (this.status < 4 && !this.isPlanStatus) {
				uni.showToast({
					title: '请先签到后再操作',
					icon: 'none',
				});
				return;
			}
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			let { partsName, partsIds, mfImgUrl, floorStandNames, floorStandIds, categoryId } = row;
			if (!floorStandIds) {
				floorStandIds = '';
			}
			if (!floorStandNames) {
				floorStandNames = '';
			}
			console.log(categoryId, 'categoryId');
			let obj = {
				partsId: partsIds,
				categoryId: categoryId || '',
				partsName,
				// desc: mfDesc,
				imgUrls: mfImgUrl,
				disabled: true,
			};
			hanleToken('set', 'partsUpObj', obj);
			uni.navigateTo({
				url:
					`/pageModules/parts/applyParts?malWorksId=${row.id}&id=${this.elevatorId}&fromPlanId=${this.planId}` +
					'&workOrderType=' +
					this.workOrderDetail.workOrderType +
					'&emerProcType=' +
					this.workOrderDetail.emerProcType +
					'&floorStandNames=' + (floorStandNames || '') +
					'&floorStandIds=' + (floorStandIds || '')
				// this.workOrderDetail.sourcePlanTypeName || '',
				// + "&malWorksId="+ row.id
			});
		},
		// 判断是否展示故障部件的编辑 删除按钮
		showBtn(item) {
			if (item.correlationList && item.correlationList.length) {
				// 存在关联任务
				if (item.correlationList.every((it) => it.planStatus == 9)) {
					// 所有关联任务均已撤回
					return true;
				}
				return false;
			}
			return true;
		},
		// 过滤维修记录数组
		filterateList(row) {
			return this.malFunctionHistories.filter(
				(item) => item.worksId == row.id && item.disposeImgUrl.length
			);
		},
		// 新增完成
		fulfil() {
			this.$refs.addWorkContent.clear();
			this.$refs.addWork.close();
			this.$nextTick(() => {
				this.initData();
			});
		},
		// 添加-故障部件
		async addWork() {
			if (!this.isPlanStatus && this.status < 4) {
				uni.showToast({
					title: '请先签到后在进行添加',
					icon: 'none',
					mask: true,
				});
				return;
			}
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}
			await this.getReasonList();
			// 禁止选择 已存在的部件
			this.disabledArr = this.workOrderDetail.faultMessageList.map((item) => {
				return {
					floorStandIds: item.floorStandIds,
					partsIds: item.partsIds.split(','),
					partsNames: item.partsName ? item.partsName.split('>') : [],
				};
			});
			this.$refs.addWork.open();
		},
		// 编辑部件 确认
		handleSave() {
			this.formError = [];
			if (!this.updateMsg.partNames) {
				uni.showToast({
					title: '请选择故障部件',
					icon: 'none',
					mask: true,
				});
				return;
			}
			if (!this.updateMsg.mfDesc) {
				this.formError.push('mfDesc');
				uni.showToast({
					title: '请填写故障描述',
					icon: 'none',
				});
				return;
			}
			if (this.updateMsg.partImg.length == 0) {
				uni.showToast({
					title: '请上传故障部件图片或视频',
					icon: 'none',
					mask: true,
				});
				return;
			}
			let works = [...this.workOrderDetail.faultMessageList];
			this.updatePartsItem.partsIds = this.updateMsg.partIds;
			this.updatePartsItem.partsNames = this.updateMsg.partNames.replaceAll(
				'>',
				'&&'
			);
			this.updatePartsItem.mfDesc = this.updateMsg.mfDesc;
			this.updatePartsItem.mfImgUrl = this.updateMsg.partImg;
			submitWork({
				...works[this.reasonIndex],
				...this.updatePartsItem,
				planId: this.planId,
				floorStandIds: this.updateMsg.floorStandIds,
				floorStandNames: this.updateMsg.floorStandNames,
			}).then((res) => {
				if (res) {
					if (this.other) {
						let partsIds = this.updateMsg.partIds.split(',');
						this.addCustompartslog({
							partId: partsIds[partsIds.length - 1],
							other: this.other,
							planId: this.planId,
							fromLocation: 'pageModules/parts/applyParts',
						});
					}
					this.$refs.updateParts.close();
					this.initData();
				}
			});
		},
		// 选择部件
		getPart(res) {
			let partIds = res.ids || [];
			let partNames = res.names || [];
			this.other = res.other;
			if (res.flag && res.flag.id) {
				this.updateMsg.floorStandIds = res.flag.ids.join(',');
				this.updateMsg.floorStandNames = res.flag.names.join(',');
			} else {
				delete this.updateMsg.floorStandIds;
				delete this.updateMsg.floorStandNames;
			}
			this.updateMsg.partIds = partIds.join(',');
			this.updateMsg.partNames = partNames.join('&&');
		},
		// 确认删除 报障部件
		comDelPart() {
			removeWork({ ids: this.updatePartsItem.id, planId: this.planId }).then(
				() => {
					this.partVisible = false;
					uni.showToast({
						title: '删除成功',
						icon: 'none',
						mask: true,
					});
					this.initData();
				}
			);
		},
		// 删除报障部件 弹窗
		delParts(item) {
			if (!this.isPlanStatus && this.status < 4) {
				uni.showToast({
					title: '请先签到后在进行添加',
					icon: 'none',
					mask: true,
				});
				return;
			}
			this.updatePartsItem = item;
			this.partVisible = true;
		},
		// 修改报障部件
		updateParts(item) {
			if (!this.isPlanStatus && this.status < 4) {
				uni.showToast({
					title: '请先签到后在进行添加',
					icon: 'none',
					mask: true,
				});
				return;
			}
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}
			this.updatePartsItem = item;
			this.updateMsg.mfDesc = item.mfDesc;
			this.updateMsg.partIds = item.partsIds;
			this.updateMsg.partNames = item.partsName;
			this.updateMsg.partImg = item.mfImgUrl;
			this.$refs.updateParts.open();
			this.$nextTick(() => {
				// #ifdef H5
				setTimeout(() => {
					this.$refs.repairFitting.showPartName(item);
				}, 100);
				// #endif

				// #ifndef H5
				this.$refs.repairFitting.showPartName(item);
				// #endif
			});
		},
		// 联系报障人
		callPhone(item) {
			uni.showModal({
				title: '报障人联系信息',
				content: `${item.name}\r\n${item.phone}`,
				showCancel: true,
				confirmColor: '#0091FF',
				cancelColor: '#000000',
				confirmText: '拨打',
				success: function (res) {
					if (res.confirm) {
						uni.makePhoneCall({
							phoneNumber: item.phone,
						});
					}
				},
			});
		},
		// 清空处理结果
		handleDel(item) {
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			this.resultDelVisible = true;
			this.updatePartsItem = item;
		},
		// 确定删除 清空处理结果
		async comDelResult() {
			this.updatePartsItem.faultImg = [];
			this.updatePartsItem.faultReasonItem = '';
			this.updatePartsItem.faultReasonOtherDesc = '';
			this.updatePartsItem.faultDesc = '';
			let works = [...this.workOrderDetail.faultMessageList];
			let removeResult = await this.getRemoveResult();
			if (!removeResult) {
				return;
			}
			submitWork({
				...works[this.reasonIndex],
				...this.updatePartsItem,
				planId: this.planId,
			}).then((res) => {
				if (res) {
					const params = {
						planId: this.planId,
						userId: this.userinfo.user_id,
						checkHistoryId: this.updatePartsItem.id,
						recordLog: '删除',
					};
					editCHeckRecord(params).then(() => {
						this.resultDelVisible = false;
						this.initData();
					});
				}
			});
		},
		// 删除维修结果验证
		getRemoveResult() {
			return new Promise((resolve) => {
				getRemoveResult({
					planId: this.planId,
				})
					.then((res) => {
						if (res) {
							console.log(res, 'resssssss的值');
							resolve(res.data);
						}
					})
					.catch((err) => console.log(err));
			});
		},

		// 添加/修改 处理结果
		async addReason(index, item, edit) {
			if (!this.isPlanStatus && this.status < 4) {
				uni.showToast({
					title: '请先签到后在进行添加',
					icon: 'none',
					mask: true,
				});
				return;
			}
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			if (
				item.faultReasonItemNames &&
				item.faultReasonItemNames.length &&
				!edit
			)
				return;
			this.reasonIndex = index;
			await this.getReasonList();
			this.$refs.finish.open();

			this.$nextTick(() => {
				setTimeout(() => {
					if (edit) {
						this.recordLog = '修改';
					} else {
						this.recordLog = '创建';
					}
					this.$refs.reason.checked(item, edit);
				}, 100);
			});
		},
		handleReasonClose() {
			this.$refs.finish.close();
			this.$refs.reason.clearData();
		},
		// 处理结果确认框
		async handleReasonComfire(msg) {
			uni.showLoading({
				title: '提交中...',
			});
			let works = [...this.workOrderDetail.faultMessageList];
			works[this.reasonIndex].proofReasonBox = false;
			try {
				const { data } = await getDerviceTime();
				console.log('获取服务器时间：', data);
				submitWork({
					...works[this.reasonIndex],
					...msg,
					planId: this.planId,
					faultSubmitTime: data,
					faultSubmitUser: this.userinfo.user_id,
				}).then((res) => {
					if (res) {
						uni.showToast({
							titel: '编辑成功',
							mask: true,
						});
						const params = {
							planId: this.planId,
							userId: this.userinfo.user_id,
							checkHistoryId: msg.id,
							recordLog: this.recordLog,
						};
						editCHeckRecord(params).then(() => {
							uni.hideLoading();
							setTimeout(async () => {
								this.$refs.finish.close();
								this.$refs.reason.clearData();
								await this.initData(this.reasonIndex);
							}, 700);
						});
					}
				});
			} catch (error) {
				console.log('获取服务器时间失败：', error);
			}
		},
		toNotSignOutOrder() {
			uni.navigateTo({
				url: `/subpages/repair/repariDetail?planId=${this.checkCanSignOutMsg.planId}&elevatorId=${this.checkCanSignOutMsg.elevatorId}`,
			});
			this.signOutModelVisible = false;
		},
		movableChange(e) {
			// console.log('movableChange', e)
			let x = e.touches[0].pageX - 56 / 2;
			let y = e.touches[0].clientY - 56 / 2;
			if (x < 8) {
				x = 8;
			}
			if (x > 330) {
				x = 330;
			}
			if (y < 70) {
				y = 70;
			}
			if (y > this.movable.height + 5) {
				y = this.movable.height + 5;
			}
			this.movable.x = x;
			this.movable.y = y;
		},
		touchend() {
			if (this.movable.x < 156) {
				this.movable.x = 8;
			} else {
				this.movable.x = this.movable.width - 55;
			}
		},
		// 预计完成时间弹框
		showChooseDate() {
			if (!this.isPlanStatus) {
				uni.showToast({
					title: '请先签到,再进行操作',
					icon: 'none',
					mask: true,
				});
				return;
			}
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			this.showState = true;
			this.$nextTick(() => {
				this.$refs.weekYear.$refs.chooseDate.open();
			});
		},
		bindClose() {
			this.showState = false;
			this.$refs.weekYear.$refs.chooseDate.close();
		},
		selectChange(res) {
			this.finishDate = res.date;
			// eslint-disable-next-line no-useless-escape
			let timeArr = res.date.replace(' ', ':').replace(/\:/g, '-').split('-');
			this.dateArr = timeArr;
			// 这里需要请求数据
			this.handleTimeUpdate();
		},
		// 修改预计时间请求数据
		handleTimeUpdate() {
			uni.showLoading({
				title: '请求中',
				icon: 'none',
			});
			timeUpdate({
				id: this.planId,
				finishDate: `${this.finishDate}${this.finishDate && this.finishDate.length < 18 ? ':00' : ''}`,
			}).then((res) => {
				if (res) {
					uni.hideLoading();
					this.getDetail();
				}
			});
		},
		// 配件更换
		toAddPart() {
			let obj = {
				planId: this.planId,
				buildingName: this.elevatorDetail.buildingName,
				elevatorAddress: this.elevatorDetail.elevatorAddress,
			};
			uni.navigateTo({
				url:
					'/pageModules/parts/partsRecord?obj=' +
					JSON.stringify(obj) +
					'&workOrderType=' +
					this.workOrderDetail.workOrderType +
					'&emerProcType=' +
					this.workOrderDetail.emerProcType,
			});
		},
		// 跳转项目详情
		toProjectDetail() {
			uni.navigateTo({
				url:
					'/pageModules/projectInfo/detail?id=' +
					this.elevatorDetail.buildingId,
			});
		},
		// 修改电梯状态弹窗提示
		changeState() {
			if (this.status === 4) {
				uni.showToast({
					title: '任务已完成',
					icon: 'none',
				});
				return;
			}
			if (!this.isPlanStatus) {
				uni.showToast({
					title: '请先签到开始,再进行操作',
					icon: 'none',
					mask: true,
				});
				return;
			}
			this.visibleEleStatus = true;
			// this.comfireChange();
		},
		cancleChange() {
			this.visibleEleStatus = false;
			this.elevatorStatus = this.elevatorDetail.isStop;
		},

		// 是否使用上次签到签退照片
		comfireUseLastImg(res) {
			console.log(this.handFinish, 8888);
			this.visibleShowTwo = false;
			this.useLastImg = res;
			let data = {
				signType: this.signType == 'in' ? 1 : 2,
				useLastImg: this.useLastImg,
				orderType: 2,
			};
			if (this.buttonType === 1) {
				data.buttonType = 1;
			}
			uni.setStorage({
				key: 'signObj',
				data,
			});

			uni.navigateTo({
				url: `/pages/sign/index?planId=${this.planId}&elevatorId=${this.elevatorId}&isFinsh=${this.handFinish}`,
			});
		},
		// 更改电梯状态
		changeElevator(nums) {
			this.elevatorStatus = nums;
		},
		// 电梯状态更改确定
		comfireChange() {
			uni.showLoading({
				title: '加载中',
				icon: 'none',
			});
			if (this.isOUtInState) {
				this.isOUtInState = false;
				if (this.cantUsersArr.length > 0) {
					this.handleFinsh(false);
				} else {
					this.$refs.finish.open();
					this.handleFinsh(false);
				}
			}
			if (this.elevatorDetail.isStop === this.elevatorStatus) {
				// 选择同状态不请求
				uni.hideLoading();
				this.visibleEleStatus = false;
				if (this.showLeave) {
					this.finishOut('');
				}
				return;
			}
			changeElevatorState({
				id: this.elevatorId,
				isStop: this.elevatorStatus,
			}).then(() => {
				this.visibleEleStatus = false;
				changeElevatorStoplog({
					elevatorId: this.elevatorId,
					initStatus: this.elevatorDetail.isStop,
					setStatus: this.elevatorStatus,
					module: `${this.planId}`,
					position: 6,
				}).then(() => {
					elevtorDetail({ elevatorId: this.elevatorId }).then((res) => {
						if (res) {
							uni.hideLoading();
							uni.showToast({
								title: '电梯状态切换成功',
								icon: 'none',
							});
							this.elevatorDetail = res.data;
							this.isFull = res.data.isFull;

							if (this.showLeave) {
								this.finishOut('');
							}
							// 设置水印缓存
							let data = {
								buildingId: this.elevatorDetail.buildingId,
								buildingName: this.elevatorDetail.buildingName,
								elevatorId: this.elevatorId,
								elevatorAddress: this.elevatorDetail.elevatorAddress,
								planId: this.planId,
							};
							uni.setStorage({
								key: 'waterMarkMsg',
								data,
								success: () => { },
							}); 
						}
					});
				});
			});
		},

		// 获取任务跟踪进度条
		getSelectWorkTracks() {
			return new Promise((resolve) => {
				getSelectWorkTracks({ planId: this.planId }).then((res) => {
					let workLogs = res.data.workLogs;
					let logs = [];
					for (let i = 0; i < this.options.length; i++) {
						let createTime = '';
						for (let j = 0; j < workLogs.length; j++) {
							if (workLogs[j].planStatus == this.options[i].status) {
								createTime = workLogs[j].createTime;
								break;
							}
						}
						logs.push({ createTime });
					}
					this.logs = logs;
					// this.$forceUpdate();
					resolve(res.data);
				});
			});
		},
		// 任务状态详情，维保员列表等信息
		async getPlanDetail() {
			return new Promise((resolve) => {
				getPlanDetail({ planId: this.planId }).then(async (res) => {
					console.log(res.data, 'eason111');
					this.planDetail = res.data;
					this.isPlanStatus = this.setIsPlanStatus();
					this.status = res.data.status;
					if (this.status == 7) {
						this.options = [
							{
								status: 2,
								name: '待开始',
								icon: '/static/images/step1.png',
							},
							{
								status: 7,
								name: '已关闭',
								icon: '/static/images/step4.png',
							},
						];
					}
					let datas = await this.getSelectWorkTracks();
					if (this.status === 7) {
						let stateRes = datas.workLogs.some((item) => item.planStatus === 3);
						if (stateRes) {
							this.options.splice(1, 0, {
								name: '维修中',
								icon: '/static/images/step2.png',
								status: 3,
							});
						}
					}
					try {
						// 更新列表卡片状态
						// eslint-disable-next-line vue/custom-event-name-casing
						uni.$emit('itemUpdate', {
							planId: this.planId,
							status: this.status,
						});
					} catch (error) {
						console.log(error);
					}
					resolve();
				});
			});
		},
		// 我自己是否还未签退
		setIsPlanStatus() {
			if (!this.planDetail.users) {
				return false;
			}
			for (let i = 0; i < this.planDetail.users.length; i++) {
				if (
					this.planDetail.users[i].userId == this.userinfo.user_id &&
					this.planDetail.users[i].signUser
				) {
					this.userSignCount = this.planDetail.users[i].userSignCount;
					return this.planDetail.users[i].signUser.isPlanStatus;
				}
			}
			this.userSignCount = 0;
			return false;
		},
		// 任务追踪页面
		goTaskSetpPage() {
			// this.elevatorDetail.planId = this.planId;
			uni.navigateTo({
				url: `/pageModules/taskStepPage/taskStepPage?planId=${this.planId}&elevatorId=${this.elevatorDetail.id}&state=1`,
				fail: (err) => {
					console.log(err);
				},
			});
		},
		updataShowFuc(val) {
			this.showPoupup = val;
		},
		handleBack() {
			// console.log(11)
			uni.navigateBack({});
		},
		async initData(reasonIndex) {
			uni.showLoading({
				title: '加载中',
				icon: 'none',
			});
			await this.getPlanDetail();

			await this.getDetail(reasonIndex);
			await this.getConfig();
			elevtorDetail({ elevatorId: this.elevatorId }).then((res) => {
				if (res) {
					this.elevatorDetail = res.data;
					this.elevatorStatus = res.data.isStop;
					this.isFull = res.data.isFull;
					uni.hideLoading();
				}
			});
			// 获取配件
			getPartListCounts({ planId: this.planId }).then((res) => {
				if (res.code === 200) {
					this.partsCounts = res.data.disFinishCounts || 0;
					this.finishCounts = res.data.finishCounts || 0;
				}
			});
			// 获取关联任务
			getWorkPartList({ planId: this.planId }).then((res) => {
				this.workOrderDetail.faultMessageList.forEach((item) => {
					item.correlationList = [];
					res.data.forEach((it) => {
						if (item.id == it.malWorksId) {
							item.correlationList.push(it);
						}
					});
				});
			});
			return;
		},
		// 获取维修工单详情
		getDetail() {
			uni.showLoading({
				title: '加载中',
				icon: 'none',
			});
			return new Promise((resolve) => {
				fetchDetail({ planId: this.planId }).then((res) => {
					if (res) {
						this.workOrderDetail = res.data;
						this.workOrderDetail.faultMessageList.forEach((item) => {
							if (item.mfDesc && item.mfDesc.indexOf('&gt;') != -1) {
								item.mfDesc = item.mfDesc.replaceAll('&gt;', '>');
							}
							// 维修记录 校验 //维修记录
							item.emptyRecord = false;
							// 处理结果 校验
							item.proofReasonBox = false;
							item.malfunctionRecordVO.reverse();
							item.count = 0;
							for (
								let idx = 0;
								idx < res.data.malFunctionHistories.length;
								idx++
							) {
								const it = res.data.malFunctionHistories[idx];
								if (!it.maintainPartsWorks) {
									// 不存在关联的记录
									if (it.worksId == item.id) {
										item.count += 1;
										continue;
									}
								} else {
									// 存在关联且 所有关联任务都已完成
									if (
										it.worksId == item.id &&
										it.maintainPartsWorks.every((j) => j.planStatus >= 7)
									) {
										item.count += 1;
										continue;
									}
								}
							}
						});
						res.data.malFunctionHistories.forEach((item) => {
							// 维修完成 校验 关联配件任务
							item.repairRecord = false;
						});
						this.malFunctionHistories = res.data.malFunctionHistories;
						uni.hideLoading();
						this.finishDate = res.data.finishDate;
						if (res.data.finishDate != null) {
							// eslint-disable-next-line no-useless-escape
							let timeArr = res.data.finishDate.replace(' ', ':').replace(/\:/g, '-').split('-');
							this.dateArr = timeArr;
						} else {
							let date = dayjs().format('YYYY-MM-DD');
							let hour = Number(dayjs().format('HH')) + 2;
							let min = dayjs().format('mm');
							let arr = [...date.split('-'), hour, min];
							this.dateArr = arr;
							this.finishDate = `${date} ${hour}:${min}`;
						}
					}
					// 获取关联任务
					getWorkPartList({ planId: this.planId }).then((res) => {
						this.workOrderDetail.faultMessageList.forEach((item) => {
							item.correlationList = [];
							res.data.forEach((it) => {
								if (item.id == it.malWorksId) {
									item.correlationList.push(it);
								}
							});
						});
					});
					resolve(res.data.elevatorDetail);
				});
			});
		},
		// 获取经纬度信息
		getLocalInfo() {
			return new Promise((resolve) => {
				if (getApp().globalData.localinfo.latitude) {
					if (
						new Date().getTime() - getApp().globalData.localinfo.time <=
						1000 * 60 * 2
					) {
						resolve(getApp().globalData.localinfo);
						return;
					}
				}

				uni.getLocation({
					type: 'gcj02',
					success(res) {
						console.log('位置信息获取成功', res);
						getApp().globalData.localinfo = {
							...res,
							time: new Date().getTime(),
						};
						resolve(res);
					},
					fail(err) {
						console.log('位置信息获取失败', err);
						resolve({});
					},
				});
			});
		},
		// 签到确认
		// confirmSignIn(distance, res, address) {
		// 	if (this.imgaddress === '') {
		// 		uni.showToast({
		// 			title: '请先上传图片',
		// 			icon: 'none',
		// 		});
		// 		return;
		// 	} else {
		// 		signinPage({
		// 			userId: this.userinfo.user_id,
		// 			planId: this.planId,
		// 			signImage: this.signImg.join(','),
		// 			signStatus: distance > this.$config.maxDistance ? 2 : 1,
		// 			signAddress: address.result.address,
		// 			signLongitude: res.longitude,
		// 			signLatitude: res.latitude,
		// 		}).then((res) => {
		// 			uni.showToast({
		// 				title: '签到成功',
		// 				icon: 'none',
		// 			});
		// 			this.imgaddress = '';
		// 			this.signImg = [];

		// 			this.$refs.popupSign.close();
		// 			this.getDetail();
		// 		});
		// 	}
		// },

		// 签退前确定电梯状态
		showStatusChangeBeforeLeave(res, type) {
			console.log(res, '看看res是什么', '维修');
			let isFinsh = res ? true : false;
			this.handFinish = isFinsh;
			this.signType = 'out';
			const data = {
				signType: this.signType == 'in' ? 1 : 2,
				useLastImg: this.useLastImg,
				orderType: 2,
			};
			this.buttonType = type;
			if (type === 1) {
				// 区分按钮类型发送群消息
				data.buttonType = 1;
				this.buttonType = 1;
			}
			uni.setStorage({
				key: 'signObj',
				data,
			});
			if (this.config.malSignOut == 1) {
				if (
					this.workOrderDetail.lastSignImg &&
					this.workOrderDetail.lastSignImg.signOutImage
				) {
					// 这里弹出弹框提示是否使用上次的照片
					this.visibleShowTwo = true;
				} else {
					uni.navigateTo({
						url: `/pages/sign/index?planId=${this.planId}&elevatorId=${this.elevatorId}&isFinsh=${isFinsh}`,
					});
				}
			} else {
				uni.navigateTo({
					url: `/pages/sign/index?planId=${this.planId}&elevatorId=${this.elevatorId}&isFinsh=${isFinsh}`,
				});
			}
		},
		// 签退 post==> 是否签退后立即执行提交操作
		async finishOut() {
			console.log(post, '签退');
			const post = this.handFinish ? true : false;
			this.showLeave = false;
			let localInfo = await this.getLocalInfo();
			if (!localInfo.latitude) {
				uni.showModal({
					title: '提示',
					content: '请打开定位，再签退',
					showCancel: false,
				});
				return;
			}
			// 计算是否范围内打卡
			let distance = getDistance(
				localInfo.latitude,
				localInfo.longitude,
				this.elevatorDetail.latitude,
				this.elevatorDetail.longitude
			);
			if (distance > this.$config.maxDistance) {
				uni.showModal({
					title: '提示',
					content: '当前不在项目位置,是否确定按照当前位置继续签退？',
					success: (res) => {
						if (res.confirm) {
							this.signType = 'out';
							this.signinData = { post: post || false };
							this.imgaddress = '';
							this.signImg = [];
							this.$refs.popupSign.open('center');
						}
					},
				});

				return;
			}
			this.signType = 'out';
			this.imgaddress = '';
			this.signImg = [];
			this.signinData = {
				post: post || false,
			};
			this.$refs.popupSign.open('center');
			return;
		},
		// 验证是否有权限 
		getPlanRole() {
			// console.log(this.planDetail);
			let next = false;
			if (!this.planDetail.users) {
				return next;
			}
			for (let i = 0; i < this.planDetail.users.length; i++) {
				if (this.planDetail.users[i].userId == this.userinfo.user_id) {
					next = true;
					break;
				}
			}
			if (!next) {
				uni.showModal({
					title: '提示',
					content: '你没有权限操作该任务',
					showCancel: false,
				});
			}
			return next;
		},

		// 点击提交完成
		async finish() {
			if (this.getPlanRole() == false) {
				return;
			}

			uni.showLoading({
				title: '加载中',
				mask: true,
			});
			await this.getPlanDetail();
			let cantUsers = [];
			if (this.planDetail.users) {
				for (let i = 0; i < this.planDetail.users.length; i++) {
					if (this.planDetail.users[i].userId == this.userinfo.user_id) {
						if (
							this.planDetail.users[i].signUser &&
							this.planDetail.users[i].signUser.isPlanStatus
						) {
							uni.hideLoading();
							this.finishOut(1);

							return;
						}
					} else {
						if (
							this.planDetail.users[i].signUser &&
							this.planDetail.users[i].signUser.isPlanStatus
						) {
							cantUsers.push(this.planDetail.users[i].userName);
						}
					}
				}
			}

			uni.hideLoading();
			if (cantUsers.length > 0) {
				uni.showModal({
					title: '提示',
					content: `同伴${cantUsers.join(
						'、'
					)}未签退，确定择强制完成，同伴自动签退；取消则等同伴签退`,
					success: (res) => {
						if (res.confirm) {
							this.postPlan();
						}
					},
				});
				return;
			}
			this.postPlan();
		},
		// 提交任务
		async postPlan() {
			uni.hideLoading();
			let localInfo = await this.getLocalInfo();
			if (!localInfo.latitude) {
				uni.showModal({
					title: '提示',
					content: '请打开定位，再提交',
					showCancel: false,
				});
				return;
			}
			uni.showModal({
				title: '提示',
				content: '提交任务后将不可修改，是否提交?',
				success: async (res) => {
					if (res.confirm) {
						uni.showLoading({
							title: '提交中',
							mask: true,
						});

						let address = await getlocalinfo(
							localInfo.latitude,
							localInfo.longitude
						);
						// let signStatus = 1;
						// 计算是否范围内打卡

						finishPlan({
							id: this.planId,
							commitAddress: address.result.address,
							commitLongitude: localInfo.longitude,
							commitLatitude: localInfo.latitude,
						})
							.then(() => {
								uni.hideLoading();
								uni.showToast({
									title: '提交成功',
								});
								setTimeout(() => {
									this.getPlanDetail();
									this.initElevtorDetail();
									this.initData();
								}, 500);
							})
							.catch((res) => {
								uni.hideLoading();
								uni.showToast({
									title: res.msg,
									icon: 'none',
								});
								setTimeout(() => {
									this.initData();
								}, 1000);
							});
					}
				},
			});
		},
		// 修改报障信息图片上传
		changeImgUrl(val) {
			console.log(val, 'val的值');
			this.updateMsg.partImg = val;
		},
		async handleStart() {
			console.log('this.getPlanRole()', this.getPlanRole());
			if (this.getPlanRole() == false) {
				return;
			}
			if (!this.showBtns) {
				uni.showModal({
					title: '提示',
					content: '你没有权限操作该任务',
					showCancel: false,
				});
				return;
			}

			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			let date = new Date(this.planDetail.planDate.replace(/-/g, '/'));
			let now = new Date();
			now.setHours(0, 0, 0);
			console.log(now.getTime() + 1000 * 60 * 60 * 24 + 2000, date.getTime());
			if (date.getTime() > now.getTime() + 1000 * 60 * 60 * 24 - 2000) {
				uni.showModal({
					title: '提示',
					content: '任务未到可执行时间',
					showCancel: false,
				});
				return true;
			}
			let isAllow = await this.checkAllowSignFun();
			if (isAllow.isExist) {
				this.checkCanSignOutMsg = isAllow;
				this.signOutModelVisible = true;
				return;
			}

			// 如果设置需要拍照,再判断24小时内是否有签到照片
			// console.log(this.config, "config");
			// return
			this.handFinish = false;
			this.signType = 'in';
			// return;
			const data = {
				signType: this.signType == 'in' ? 1 : 2,
				useLastImg: this.useLastImg,
				orderType: 2,
			};
			uni.setStorage({
				key: 'signObj',
				data,
			});
			if (this.config.malSignIn == 1) {
				if (
					this.workOrderDetail.lastSignImg &&
					this.workOrderDetail.lastSignImg.signImage
				) {
					// 这里弹出弹框提示是否使用上次的照片
					this.visibleShowTwo = true;
				} else {
					uni.navigateTo({
						url: `/pages/sign/index?planId=${this.planId}&elevatorId=${this.elevatorId}`,
					});
				}
			} else {
				uni.navigateTo({
					url: `/pages/sign/index?planId=${this.planId}&elevatorId=${this.elevatorId}`,
				});
			}
		},
		addRecord(row) {
			// 如果没有签到过不能操作
			console.log(this.userSignCount, this.status);
			if (this.userSignCount == 0 && this.status == 4) {
				return;
			}
			if (!this.isPlanStatus && this.status < 4) {
				uni.showToast({
					title: '请先签到后在进行添加',
					icon: 'none',
					mask: true,
				});
				return;
			}
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}
			this.worksId = row.id;
			this.addRecordMsg = { partsName: row.partsName, partsIds: row.partsIds, floorStandIds: row.floorStandIds, floorStandNames: row.floorStandNames };
			this.$refs.popup.open();
			setTimeout(() => {
				this.$nextTick(() => {
					// 配件赋值
					this.$refs.addRecord.setPart(row);
				});
			}, 1000);
		},
		closeRecord() {
			this.$refs.popup.close();
			this.aa = '0';
		},
		// 关闭提交按钮
		handleSubmit() {
			// this.showAddDialog=false
			this.$refs.popup.close();
			this.aa = '1';
			this.getDetail();
		},
		// 拨打电话
		handleCall() {
			this.$nextTick(() => {
				this.$refs.property.$refs.propertyPhone.open();
			});
		},
		closePhone() {
			this.$nextTick(() => {
				this.$refs.property.$refs.propertyPhone.close();
			});
		},
		// 编辑维修记录
		editingRecord(item, msg) {
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			this.worksId = item.id;
			this.$refs.popup.open();
			this.$nextTick(() => {
				// 编辑回显
				// #ifdef H5
				setTimeout(() => {
					this.$refs.addRecord.checked({ ...msg, partsName: item.partsName });
					// 编辑回显
				}, 100);
				// #endif

				// #ifndef H5
				this.$refs.addRecord.checked({ ...msg, partsName: item.partsName });
				// 编辑回显
				// #endif
			});
		},
		// 保存提交按钮
		updateRecord({ isEdit, type }) {
			console.log(type, isEdit);
			// this.isEditFlag = isEdit;
			this.getDetail();
		},
		// 确认完成
		comfire() {
			this.visibleShow = false;
			this.toAddPart();
		},
		// 维修完成
		async handleFinsh() {
			if (this.isCreateFrom) {
				uni.showToast({
					title: '转出工单无法操作',
					icon: 'none',
					mask: true,
				});
				return;
			}

			this.workOrderDetail.faultMessageList.forEach((item) => {
				if (item.partsIds && item.partsIds != 0) {
					// 没有配件任务记录
					if (this.filterateList(item).length != item.count) {
						this.filterateList(item).forEach((it) => {
							if (it.worksId == item.id) {
								it.repairRecord = true;
								item.colorRecord = true;
							}
						});
						if (this.partsCounts > 0) {
							// 还有配件任务未完成
							this.visibleShow = true;
						}
					} else {
						item.colorRecord = false;
					}
					if (
						(item.partsIds &&
							item.partsIds != 0 &&
							!item.faultReasonItemNames) ||
						(item.faultReasonItemNames && item.faultReasonItemNames.length == 0)
					) {
						item.proofReasonBox = true;
					} else {
						item.proofReasonBox = false;
					}
				}
			});
			for (
				let index = 0;
				index < this.workOrderDetail.faultMessageList.length;
				index++
			) {
				const item = this.workOrderDetail.faultMessageList[index];
				if (
					this.workOrderDetail.faultMessageList.length == 1 &&
					item.problemItem
				) {
					uni.showToast({
						title: '请添加故障部件',
						icon: 'none',
						mask: true,
					});
					return;
				}

				if (item.partsIds && item.partsIds != 0) {
					// 没有配件任务记录
					if (this.filterateList(item).length === 0) {
						uni.pageScrollTo({
							scrollTop: 0,
							duration: 0,
						});
						uni.showToast({
							title: '请先添加维修记录',
							icon: 'none',
							mask: true,
						});
						// 这里定位到空的数据框
						item.emptyRecord = true;
						let that = this;
						const query = uni.createSelectorQuery().in(that);
						query
							.select(`.reasonBox${index + 1}`)
							.boundingClientRect((data) => {
								uni.pageScrollTo({
									scrollTop: data.top - 350,
									duration: 0,
								});
							})
							.exec();
						return;
					}
					// if (this.filterateList(item).length != item.count) {
					//   this.filterateList(item).forEach((it) => {
					//     if (it.worksId == item.id) {
					//       it.repairRecord = true;
					//       item.colorRecord = true;
					//     }
					//   });
					//   if (this.partsCounts > 0) {
					//     //还有配件任务未完成
					//     this.visibleShow = true;
					//   }
					//   uni.pageScrollTo({
					//     scrollTop: 0,
					//     duration: 0,
					//   });
					//   let that = this;
					//   const query = uni.createSelectorQuery().in(that);
					//   query
					//     .select(`.repairRecord${index}`)
					//     .boundingClientRect((data) => {
					//       uni.pageScrollTo({
					//         scrollTop: data.top,
					//         duration: 0,
					//       });
					//     })
					//     .exec();
					//   return;
					// } else {
					//   item.colorRecord = false;
					// }
				}
				if (
					(item.partsIds && item.partsIds != 0 && !item.faultReasonItemNames) ||
					(item.faultReasonItemNames && item.faultReasonItemNames.length == 0)
				) {
					item.proofReasonBox = true;
					uni.pageScrollTo({
						scrollTop: 0,
						duration: 0,
					});
					uni.showToast({
						title: '请添加维修结果',
						icon: 'none',
						mask: true,
					});
					let that = this;
					const query = uni.createSelectorQuery().in(that);
					query
						.select(`.reasonBox${index + 1}`)
						.boundingClientRect((data) => {
							uni.pageScrollTo({
								scrollTop: data.top - 400,
								duration: 0,
							});
						})
						.exec();
					return;
				} else {
					item.proofReasonBox = false;
				}
			}
			// debugger
			console.log('维修完成');
			// 初始化签退-完成逻辑
			this.handFinish = false;
			if (this.status === 4 && !this.workOrderDetail.updateStatus) {
				this.handleDone();
				return;
			}

			uni.showLoading({
				title: '提交中',
				mask: true,
			});
			await this.getDetail();

			if (this.workOrderDetail.partsCount > 0) {
				// 还有配件任务未完成
				this.visibleShow = true;
				return;
			}
			if (this.isPlanStatus) {
				this.handFinish = true;
				this.showStatusChangeBeforeLeave(true, 1);
				return;
			}

			await this.getPlanDetail();
			let cantUsers = [];

			if (this.planDetail.users) {
				for (let i = 0; i < this.planDetail.users.length; i++) {
					if (this.planDetail.users[i].userId == this.userinfo.user_id) {
						if (
							this.planDetail.users[i].signUser &&
							this.planDetail.users[i].signUser.isPlanStatus
						) {
							uni.hideLoading();
							this.handFinish = true;

							this.showStatusChangeBeforeLeave(true);

							return;
						}
					} else {
						if (
							this.planDetail.users[i].signUser &&
							this.planDetail.users[i].signUser.isPlanStatus
						) {
							cantUsers.push(this.planDetail.users[i].userName);
						}
					}
				}
			}
			this.cantUsersArr = cantUsers;
			if (cantUsers.length > 0) {
				uni.showModal({
					title: '提示',
					content: `同伴${cantUsers.join(
						'、'
					)}未签退，确定择强制完成，同伴自动签退；取消则等同伴签退`,
					success: async (res) => {
						if (res.confirm) {
							/* 定位上报埋点*/
							this.reportAddress({
								userId: this.userinfo.user_id,
								operation: 5,
								planId: this.planId,
								recordType: 1,
							});
							/* 定位上报埋点 end*/
							finish({ planId: this.planId }).then((res) => {
								if (res) {
									uni.hideLoading();
									this.initData();
								}
							});
						}
					},
				});
				return;
			} else {
				/* 定位上报埋点*/
				this.reportAddress({
					userId: this.userinfo.user_id,
					operation: 5,
					planId: this.planId,
					recordType: 1,
				});
				/* 定位上报埋点 end*/
				finish({ planId: this.planId }).then((res) => {
					if (res) {
						uni.hideLoading();
						this.initData();
						if (this.openReport) {
							this.showMsgFlag = false;
							uni.navigateTo({
								url: '/subpages/repair/reportEdit?planId=' + this.planId,
							});
						}
					}
				});
			}
		},
		// 多人维修检查状态
		handleDone() {
			// console.log("工单完成");
			uni.showToast({
				title: '工单状态已更新,请重新进入页面',
				icon: 'none',
			});
			setTimeout(() => {
				uni.navigateBack({});
			}, 500);
		},
		getReasonList() {
			return new Promise((resolve) => {
				uni.showLoading({
					title: '请求中...',
					icon: 'none',
				});
				falutReason({}).then((res) => {
					console.log(res, '原因');
					if (res) {
						this.reasonList = res.data;
						this.otherId = this.reasonList.find(
							(item) => item.dictValue === '其他'
						).dictKey;
						uni.hideLoading();
					}
					resolve(res.data);
				});
			});
		},
		getAliasStr(str) {
			if (!str) {
				return '';
			}
			if (str.length > 20) {
				return '(项目别名：' + str.slice(0, 20) + '...)';
			} else {
				return '(项目别名：' + str + ')';
			}
		},
		// 导航
		handleGuide() {
			console.log(this.elevatorDetail, 6666);
			const {
				buildingName,
				relationAlias,
				latitude,
				longitude,
				buildingAddress,
			} = this.elevatorDetail;
			let alias = relationAlias;
			let aliasName = alias.length
				? alias
					.map((item) => {
						return item.alias;
					})
					.join(',')
				: '';
			uni.getLocation({
				// 返回可以用于uni.openLocation的经纬度
				type: 'gcj02',
				success: () => {
					console.log(latitude, longitude);
					uni.openLocation({
						latitude: Number(latitude),
						longitude: Number(longitude),
						scale: 18,
						name: buildingName + this.getAliasStr(aliasName),
						address: buildingAddress,
						success: () => {
							console.log('success');
						},
					});
				},
			});
		},
		getConfig() {
			return new Promise((resolve) => {
				getConfig().then((res) => {
					if (res) {
						this.config = res.data.config;
						// console.log(this.config, "this.config");
					}
				});
				resolve();
			});
		},
		checkAllowSignFun() {
			return new Promise((resolve) => {
				checkCanSignOut({ planId: this.planId }).then((res) => {
					if (res) {
						resolve(res.data);
					}
				});
			});
		},
		// 项目别名弹窗
		petName(obj) {
			this.popupShow = true;
			this.overflowShow = true;
			this.aliasArr = (obj.relationAlias || []).map((item) => item.alias);
		},
		closedMask() {
			this.overflowShow = false;
			this.popupShow = false;
		},
		showExample(type) {
			console.log(type, 'exampleType');
			this.$refs.examplePopup.open();
			this.exampleType = type;
		},
		previewReport() {
			this.showMsgFlag = false;
			uni.navigateTo({
				url: '/subpages/repair/reportEdit?planId=' + this.planId,
			});
		},
		checkReport() {
			uni.navigateTo({
				url: '/subpages/repair/reportShare?id=' + this.workOrderDetail.reportId,
			});
		},
		// 根据维修工单获取报告统计
		async onGetReportCountByRepair() {
			try {
				const res = await getReportCountByRepair({ planId: this.planId });
				if (res && res.code == 200 && res.data) {
					console.log(res, 'res');
					this.judge = res.data.judge;
					if (this.judge === 2) {
						// 启用返回提示
						// wx.enableAlertBeforeUnload({
						// 	message: '检测到尚未发送维修报告，请确认报告无误后立即发送',
						// 	success: (res) => {
						// 		console.log(res, 'enableAlertBeforeUnload-res');
						// 	},
						// 	fail: (err) => {
						// 		console.log(err, 'enableAlertBeforeUnload-err');
						// 	},
						// });
					} else {
						// 卸载返回提示
						// wx.disableAlertBeforeUnload({
						// 	success: (res) => {
						// 		console.log(res, 'disableAlertBeforeUnload-res');
						// 	},
						// 	fail: (err) => {
						// 		console.log(err, 'disableAlertBeforeUnload-err');
						// 	},
						// });
					}
				}
			} catch (error) {
				console.log(error);
			}
		},
		// 根据电梯ID获取维修报告配置
		async onGetReportConfig() {
			try {
				const res = await getReportConfig({ elevatorId: this.elevatorId });
				if (res && res.code == 200 && res.data) {
					console.log(res, 'res-getReportConfig');
					this.openReport = res.data;
				}
			} catch (error) {
				console.log(error);
			}
		},
		// app端消息条件满足显示弹框
		funcModelShow(status = false, types = '') {
			if (status) {
				uni.showModal({
					title: types === 'STATUS_IN' ? '签到提醒' : '签退提醒',
					content: types === 'STATUS_IN' ? '已进入工单作业范围，请及时签到' : '已离开工单作业范围，请及时签退',
					confirmText: types === 'STATUS_IN' ? '立即签到' : '立即签退',
					cancelText: '取消',
					cancelColor: '#999999',
					confirmColor: '#0091ff',
					success: (res) => {
						if (res.confirm) {
							console.log('用户点击确定');
							let data = {
								signType: 1,
								useLastImg: true,
								orderType: 2,
							};
							if (types === 'STATUS_IN') {
								data.signType = 1;
							} else {
								data.signType = 2;
							}
							uni.setStorage({
								key: 'signObj',
								data,
							});
							uni.navigateTo({
								url: `/pages/sign/index?planId=${this.planId}&elevatorId=${this.elevatorId}`,
							});
						} else if (res.cancel) {
							console.log('用户点击取消');
						}
					},
				});
			}
		},
	},
};
</script>

<style lang="scss">
page {
	height: 100%;
	background-color: #f3f6f8;
	font-size: 28rpx;
}
</style>

<style lang="scss" scoped>
$all_width: 96rpx;
$all_height: 96rpx;

.lastImg {
	padding: 30rpx 0 60rpx 0;
	text-indent: 2em;
}

/deep/ .useritem {
	overflow: auto;
}

.finishDateContent {
	display: flex;
	justify-content: space-between;
	padding-bottom: 24rpx;
	color: #666;
	border-bottom: 2rpx solid #e9e9e9;
	margin-bottom: 22rpx;

	.timeArea {
		display: flex;
		align-items: center;

		image {
			width: 32rpx;
			height: 32rpx;
		}

		.timeStr {
			color: #0091ff;
		}
	}
}

.close_desc {
	margin-top: 10px;

	.close_desc_item {
		font-size: 14px;
		color: #333333;
	}

	.close_desc_cont {
		font-size: 12px;
		color: #999999;
	}
}

.addressBox {
	width: 710rpx;
	margin: 0 auto;
	background: #fff;
	border-radius: 8rpx;
	font-size: 24rpx;
	padding: 20rpx 22rpx 16rpx 16rpx;
	font-size: 24rpx;
	color: #999;
	box-sizing: border-box;
	margin-bottom: 20rpx;
	position: relative;
	z-index: 110;
	display: flex;

	.top {
		display: flex;

		.name {
			display: flex;
			// padding-left: 14rpx;
			font-weight: 600;
			color: #333;
			align-items: center;
		}

		image {
			width: 32rpx;
			height: 32rpx;
		}

		view {
			margin-left: 10rpx;
		}
	}

	.buildAddress {
		padding: 6rpx 20rpx 0 32rpx;
		margin-left: 10rpx;
		width: 388rpx;
		margin-right: 30rpx;
		display: flex;
		align-items: center;

		.buildings {
			overflow: hidden;
			text-overflow: ellipsis;
			white-space: nowrap;
			max-width: 388rpx;
			font-size: 20rpx;
			color: #666;
		}
	}

	.addressBox_right {
		display: flex;
		flex: 1;
		justify-content: flex-end;

		align-items: center;
	}

	.gpsAndCall {
		position: relative;
		display: flex;
		align-items: center;
		width: 190rpx;
		color: #666;

		.gpsAndCall_item {
			display: flex;
			flex: 1;
		}

		.guide {
			justify-content: flex-end;
		}

		image {
			width: 32rpx;
			height: 32rpx;
		}

		.line {
			width: 2rpx;
			height: 24rpx;
			background: #e9e9e9;
			position: absolute;
			left: 50%;
			top: 6rpx;
		}
	}
}

.statusArea {
	padding: 10rpx 20rpx;
	background: #ffffff;
	border-radius: 8rpx;
	display: flex;
	font-size: 26rpx;
	position: absolute;
	font-weight: 500;
	right: 20rpx;
	top: 40rpx;
	z-index: 120;

	image {
		width: 32rpx;
		height: 32rpx;
	}
}

.repari_result {
	margin-top: 20rpx;
	background: #ffffff;
	border-radius: 8rpx;
	padding: 0 20rpx;
	padding-bottom: 20rpx;
	box-shadow: 0px 0px 8rpx 0px rgba(0, 0, 0, 0.2);
}

.repari_result_new {
	background: #f6f7fa;
	padding: 0 20rpx;
	border-radius: 0 0 8rpx 8rpx;
	padding: 20rpx 40rpx;

	.line {
		display: flex;
		justify-content: center;

		text {
			width: 64rpx;
			height: 10rpx;
			background: #d8d8d8;
			border-radius: 6rpx;
		}
	}

	.top {
		display: flex;
		justify-content: space-between;
		align-items: center;
		padding: 30rpx 0;
		font-size: 32rpx;
		color: #333;
		font-weight: bold;

		.resultTitle {
			font-size: 28rpx;
			color: #333;
			font-weight: bold;
			border-left: 4rpx solid #0091ff;
			padding-left: 10rpx;
		}
	}

	.handle {
		// width: 412rpx;
		display: flex;
		height: 100%;

		.handle_item {
			display: flex;
			justify-content: flex-end;
			// width: 100%;
			padding-top: 2rpx;
			box-sizing: border-box;
			width: 290rpx;
		}

		image {
			width: 32rpx;
			height: 32rpx;
			// margin-top: 2rpx;
		}

		.addBtn {
			border-right: 2rpx solid #e9e9e9;
			// justify-content: center;
			padding-right: 12rpx;
			font-size: 12px;
			color: #666666;
			margin: 0 14rpx 0 10rpx;
		}

		.editBtn {
			justify-content: center;
			// padding-right: 30rpx;
		}

		.delBtn {
			padding-left: 20rpx;
		}

		view {
			display: flex;
			// flex: 1;
			justify-content: flex-end;
		}

		.saveBtn {
			color: #0091ff;
			width: 100%;
			display: flex;
			align-items: center;
			font-size: 24rpx;

			text {
				margin-left: 4rpx;
			}
		}
	}

	.content_item {
		margin-bottom: 16rpx;

		.name {
			font-size: 26rpx;
			margin-bottom: 16rpx;
			font-weight: bold;
			color: #333;
			border-left: 4rpx solid #0091ff;
			padding-left: 10rpx;

			text {
				color: #e54b4b;
			}
		}
	}

	.noPadding {
		padding-bottom: 0rpx;
	}

	.notice {
		width: 100%;
		padding-bottom: 20rpx;

		.name {
			display: flex;
			font-weight: bold;
			font-size: 26rpx;
			color: #333;
			margin-bottom: 16rpx;
			border-left: 4rpx solid #0091ff;
			padding-left: 10rpx;

			:nth-child(2) {
				font-weight: normal;
				color: #999999;
			}
		}

		.area {
			padding: 20rpx;
			border: 2rpx solid #e9e9e9;
		}

		textarea {
			font-size: 28rpx;
			height: 80rpx;
			width: 100%;
		}

		.length {
			text-align: right;
			color: #ccc;
		}
	}

	.error {
		color: #e02020;
		font-size: 24rpx;
	}

	.imgBox {
		.name {
			margin-bottom: 16rpx;
			font-size: 26rpx;
			font-weight: bold;
			color: #333;
			border-left: 4rpx solid #0091ff;
			padding-left: 10rpx;

			text {
				color: #e54b4b;
			}
		}
	}

	.delRepairRec {
		font-size: 24rpx;
		margin-bottom: 40rpx;
		text-align: center;
	}

	.save {
		margin-top: 18rpx;
		display: flex;
		justify-content: center;

		button {
			display: flex;
			width: 670rpx;
			height: 70rpx;
			border-radius: 8rpx;
			justify-content: center;
			align-items: center;
		}
	}

	.correlationBox {
		background: #ffffff;
		border-radius: 4px;
		margin-bottom: 20rpx;
		padding: 12rpx 8rpx;
		box-shadow: 0px 1px 6px 0px rgba(153, 153, 153, 0.04);

		&_row {
			font-size: 24rpx;
			color: #666;
			display: flex;
			align-items: center;

			.right {
				display: flex;
				flex: 1;
				justify-content: flex-end;
			}

			.correlationStatus {
				display: flex;
				align-items: center;
			}

			&_title {
				margin-right: 20rpx;
			}

			&_tag {
				background: #0091ff;
				border-radius: 4rpx;
				color: #fff;
				padding: 2rpx 4rpx;
				margin-left: 6rpx;
			}

			&_maxTag {
				border-radius: 4rpx;
				padding: 2rpx 6rpx;
				margin-right: 10rpx;
			}
		}
	}
}

.partTask {
	padding-bottom: 20rpx;
}

.rePair_detail {
	.signCircle {
		height: 80rpx;
		width: 80rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background: #0091ff;
		color: #fff;
		position: fixed;
		z-index: 200;
		border-radius: 50%;
	}

	.nav {
		position: sticky;
		top: 0;
		z-index: 112;
	}

	.bg {
		width: 750rpx;
		height: 354rpx;
		position: absolute;
		top: 0;
	}

	.header {
		padding-left: 40rpx;
		padding-right: 32rpx;
		margin-bottom: 50rpx;
		padding-top: 28rpx;
		position: relative;
	}

	.progressBar_elevator {
		width: 710rpx;
		margin: 0 auto;
		background: #fff;
		border-radius: 8rpx;
		margin-bottom: 20rpx;
		display: flex;
		height: 84rpx;
		line-height: 84rpx;
		z-index: 300;

		view:nth-of-type(1) {
			flex: 1;
			font-size: 32rpx;
			font-weight: 500;
			color: #333333;
			margin-left: 20rpx;
		}

		view:nth-of-type(2) {
			flex: 0 0 200rpx;
			text-align: right;
			font-size: 26rpx;
			color: #0091ff;
			border-radius: 8rpx;
			padding: 0rpx 30rpx;
			vertical-align: middle;

			text {
				margin-right: 8rpx;
			}

			image {
				width: 32rpx;
				height: 32rpx;
				vertical-align: middle;
			}
		}
	}

	.content_box {
		padding: 0 20rpx;
		background-color: #f3f6f8;
		padding-bottom: 150rpx;
		position: relative;

		.content_item {
			margin-bottom: 20rpx;
			padding: 28rpx 20rpx;
			border-radius: 8rpx;
			background: #ffffff;

			.title {
				font-size: 32rpx;
				color: #333;
				font-weight: bold;
				margin-bottom: 22rpx;
				padding-left: 10rpx;
				border-left: 4rpx solid #0091ff;
			}

			.des {
				margin-bottom: 20rpx;

				.flexBox {
					display: flex;
					align-items: flex-start;
					justify-content: space-between;

					.promTit {
						margin-right: 20rpx;
					}

					.btn {
						// width: 120rpx;
						margin-left: auto;
						display: flex;
						align-items: center;
						justify-content: space-between;
						padding-bottom: 22rpx;

						image {
							width: 32rpx;
							height: 32rpx;
						}

						.btnView {
							width: 2rpx;
							height: 32rpx;
							background: #e9e9e9;
							margin: 0 20rpx;
						}
					}

					.reportingName {
						display: flex;
						align-items: center;
						font-size: 24rpx;
						color: #666666;
						background: #dcf0ff;
						border-radius: 4rpx;
						padding: 0rpx 16rpx;
						margin-top: 2rpx;
					}

					.numberTag {
						display: inline-block;
						width: 40rpx;
						height: 40rpx;
						line-height: 40rpx;
						text-align: center;
						font-weight: normal;
						background: #ddf0ff;
						border-radius: 2px;
						color: #0091ff;
						font-size: 13px;
					}
				}

				.descBox {
					display: flex;
					align-items: flex-start;
					padding-bottom: 20rpx;

					image {
						width: 32rpx;
						height: 32rpx;
					}

					.title {
						width: 180rpx;
						font-size: 28rpx !important;
						color: #999 !important;
						padding: 0 !important;
						font-weight: normal !important;
						margin: 0;
						border: none;
						margin-right: 20rpx;
					}

					.descBox_label {
						color: #333;
						font-size: 28rpx;
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
						flex: 1;
					}

					.content {
						font-size: 28rpx !important;
						color: #333;
						word-break: break-all;
					}

					.noWrap {
						overflow: hidden;
						text-overflow: ellipsis;
						white-space: nowrap;
					}

					.descItem {
						flex: 1;
					}

					.desBnt {
						color: #0091ff;
						margin-left: 10rpx;
					}

					.tabs {
						display: flex;
						align-items: center;
						justify-content: space-around;
						margin-left: -20rpx;
						margin-right: -20rpx;
						border-bottom: 2rpx solid #eee;

						&_item {
							font-size: 26rpx;
							color: #93b1c7;
							padding-bottom: 20rpx;

							.badge {
								display: inline-block;
								width: 28rpx;
								height: 28rpx;
								line-height: 28rpx;
								border-radius: 50%;
								background: #6dd400;
								color: #fff;
								font-size: 24rpx;
								text-align: center;
								font-weight: normal;
								margin-left: 10rpx;
							}
						}

						.active {
							color: #0091ff;
							font-size: 30rpx;
							font-weight: bold;
							padding-bottom: 20rpx;
							border-bottom: 4rpx solid #0091ff;
						}
					}

					.addBtn {
						background: #fff;
						color: #0091ff;
						border: 2rpx solid #0091ff;
						border-radius: 8rpx;
						margin-top: 20rpx;
						padding: 18rpx 0;
						display: flex;
						align-items: center;
						justify-content: center;

						image {
							width: 24rpx;
							height: 24rpx;
							margin-top: 4rpx;
							margin-right: 10rpx;
						}
					}

					.disableBtn {
						color: #cccccc;
						border: 2rpx solid #cccccc;
					}

					.reasonBox {
						border: 2rpx solid #e02020;
					}

					.moreBox {
						display: flex;
						align-items: center;
						justify-content: center;
						margin-top: 20rpx;

						.icon {
							display: inline-block;
							width: 12rpx;
							height: 12rpx;
							line-height: 20rpx;
							border-left: 2rpx #999999 solid;
							border-bottom: 2rpx #999999 solid;
							transform: rotate(-45deg);
							margin-right: 12rpx;
						}
					}
				}

				.falsutBox {
					padding: 0;
					align-items: flex-start;
				}

				.des_buttonBox {
					display: flex;
					align-items: center;
					justify-content: space-between;
					font-size: 28rpx;
					margin-bottom: 20rpx;

					&_item {
						width: 30%;
						box-sizing: border-box;
						background: #0091ff;
						border-radius: 8rpx;
						color: #fff;
						padding: 8rpx 16rpx;
						text-align: center;
					}

					.btn-disabled {
						background: #dddddd;
						color: #999;
						opacity: 0.8;
					}

					.red {
						background: red;
					}
				}

				.des_content {
					width: 100%;
					margin-top: 20rpx;
					border-radius: 8rpx;
					// background: #f6f7fa;
					// padding: 20rpx 20rpx 0;
				}
			}

			.label {
				margin-right: 24rpx;
				color: #999999;
				font-size: 28rpx;
				width: 180rpx !important;
				margin-bottom: 10rpx;
			}

			.status_content {
				display: flex;
				flex-wrap: wrap;
				flex: 1;

				.status {
					padding: 4rpx 16rpx;
					border-radius: 8rpx;
					font-size: 26rpx;
					margin-bottom: 20rpx;
					margin-left: 4rpx;
				}

				.stops {
					border: 2rpx solid #e02020;
					color: #e02020;
					margin-right: 12rpx;
				}

				.normal {
					border: 2rpx solid #0091ff;
					color: #0091ff;
					margin-right: 12rpx;
				}
			}

			.stop {
				// border: 2rpx solid #e02020;
				color: #333;
				margin-right: 12rpx;
				padding: 4rpx 0;
			}

			.falutItem {
				color: #333;
				display: flex;
				align-items: center;

				.tag {
					font-size: 26rpx;
					padding: 4rpx 16rpx;
					border-radius: 8rpx;
					margin-bottom: 20rpx;
					border: 2rpx solid transparent;
				}

				.normal {
					border: 2rpx solid #0091ff;
					color: #0091ff;
					margin-right: 12rpx;
				}

				.status {
					padding: 4rpx 16rpx;
					border-radius: 8rpx;
					font-size: 26rpx;
					margin-bottom: 20rpx;
				}

				.stops {
					border: 2rpx solid #e02020;
					color: #e02020;
					margin-right: 12rpx;
				}

				.marginTop {
					margin-top: 12px;
				}
			}

			.orderfalutDes {
				:nth-child(1) {
					width: 200rpx;
				}

				margin-bottom: 40rpx;
			}

			.time {
				display: flex;
				color: #999;
				font-size: 28rpx;
				// margin-top: 40rpx;

				.label {
					margin-right: 24rpx;
					color: #999999;
					font-size: 28rpx;
					width: 112rpx;
				}
			}

			.msg_box {
				display: flex;
				align-items: center;
				color: #333333;
				margin-bottom: 20rpx;

				&_label {
					width: 112rpx;
					margin-right: 34rpx;
					color: #999999;
				}
			}
		}

		.faultReasonContent {
			padding: 0 20rpx;

			.faultReasonItem {
				margin-bottom: 40rpx;

				.label {
					color: #999;
					width: 100%;
					margin-bottom: 6rpx;
				}

				.falutLabel {
					display: flex;
					flex-wrap: wrap;

					view {
						padding: 4rpx 16rpx;
						font-size: 28rpx;
						border: 2rpx solid #0091ff;
						border-radius: 8rpx;
						color: #0091ff;
						margin-right: 20rpx;
						margin-top: 12rpx;
					}
				}
			}

			.msg {
				font-size: 24rpx;
				color: #999999;
				margin-top: 16rpx;

				view {
					height: 34rpx;
				}
			}
		}

		.progressBar {
			display: flex;
			justify-content: center;
			margin-bottom: 20rpx;

			.progressBar_content {
				width: 710rpx;
				// height: 284rpx;
				background: #ffffff;
				border-radius: 8rpx;
				padding: 24rpx 22rpx 0rpx 18rpx;
				box-sizing: border-box;
			}
		}
	}

	.bottom {
		position: fixed;
		bottom: 0;
		left: 0;
		z-index: 200;
		background-color: #fff;
		height: 100rpx;
		width: 100%;
		display: flex;
		border-top: 2rpx solid #eeeeee;
		box-sizing: border-box;
		padding: 0 20rpx;

		view {
			// height: 100%;
			display: flex;
			align-items: center;
		}

		.left {
			width: 200rpx;
			font-size: 20rpx;

			.left_item {
				display: flex;
				flex-direction: column;
				flex: 1;

				view {
					width: 100%;
					display: flex;
					flex: 1;
					justify-content: center;
					// background: red;
					color: #666;
				}

				image {
					width: 48rpx;
					height: 48rpx;
				}
			}
		}

		.right {
			flex: 1;

			.start {
				// width: 524rpx;
				height: 70rpx;
				background: #0091ff;
				border-radius: 8rpx;
				color: #fff;
				display: flex;
				flex: 1;

				.finBtn {
					width: 100%;
					display: flex;
					justify-content: center;
					align-items: center;
				}
			}

			.grey {
				background: #ccc;
			}

			.repariing {
				// width: 100%;
				display: flex;
				flex: 1;
				justify-content: space-between;
				align-items: center;

				view {
					display: flex;
					flex: 1;
					justify-content: center;
					height: 70rpx;
					border-radius: 8rpx;
				}

				.add {
					background: #0091ff;
					margin-right: 14rpx;
					color: #fff;
					font-size: 26rpx;
				}

				.addRed {
					position: relative;

					text {
						position: absolute;
						top: -10rpx;
						right: 0;
						width: 30rpx;
						height: 30rpx;
						background: red;
						border-radius: 15rpx;
						font-size: 20rpx;
						text-align: center;
					}
				}

				.finish {
					background: #efefef;
					color: #cccccc;
					font-size: 26rpx;
				}
			}
		}
	}

	.change_elevator {
		display: flex;
		flex-direction: row;
		justify-content: center;

		.actElevator {
			// background-color: #0091ff;
			font-size: 24rpx !important;
			color: #0091ff !important;
			border: 2rpx #0091ff solid !important;
		}

		view:nth-of-type(1) {
			// background-color: #0091ff;
			color: #666;
			height: 72rpx;
			width: 176rpx;
			line-height: 72rpx;
			text-align: center;
			border-radius: 8rpx;
			border: 2rpx #ccc solid;
			font-size: 24rpx;
			margin-right: 60rpx;
		}

		view:nth-of-type(2) {
			font-size: 24rpx;
			color: #666;
			height: 72rpx;
			width: 176rpx;
			line-height: 72rpx;
			text-align: center;
			border-radius: 8rpx;
			border: 2rpx #ccc solid;
		}
	}

	.delPartBox {
		font-size: 24rpx;
		color: #333;

		.content {
			margin-bottom: 10rpx;
		}

		.subContetn {
			background: #f3f6f8;
			padding: 20rpx;

			:nth-child(1) {
				font-size: 30rpx;
				color: #333;
				font-weight: bold;
			}

			:nth-child(2) {
				color: #666;
			}
		}
	}

	.comfireBox {
		text-align: center;

		.content {
			color: #999;
			padding-top: 10rpx;
			font-size: 24rpx
		}
	}

	.proDesc {
		margin-bottom: 10rpx;

		.proDescTitle {
			padding: 0;
			padding-left: 10rpx;
			width: calc(100% - 300rpx);
		}
	}
}
</style>
